[vlc-devel] commit: Fix off-by-one error ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Jul 5 22:59:50 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jul  6 00:01:49 2008 +0300| [c5942976c0b820a187b5997151c34516ef9880cb]

Fix off-by-one error

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c5942976c0b820a187b5997151c34516ef9880cb
---

 src/winvlc.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/winvlc.c b/src/winvlc.c
index 80f2259..18c1b13 100644
--- a/src/winvlc.c
+++ b/src/winvlc.c
@@ -91,9 +91,9 @@ static int parse_cmdline (char *line, char ***argvp)
  * wWinMain: parse command line, start interface and spawn threads.
  *****************************************************************************/
 int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
-                    LPWSTR lpCmdLine, int nCmdShow )
+                     LPWSTR lpCmdLine, int nCmdShow )
 {
-    char **argv, psz_cmdline[wcslen(lpCmdLine) * 4];
+    char **argv, psz_cmdline[wcslen(lpCmdLine) * 4 + 1];
     int argc, ret;
 
     (void)hInstance; (void)hPrevInstance; (void)nCmdShow;
@@ -129,8 +129,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     LPSTR args, int nCmdShow)
 {
     /* This makes little sense, but at least it links properly */
-    wchar_t lpCmdLine[strlen(args) * 3];
-    MultiByteToWideChar( CP_ACP, 0, args, -1, lpCmdLine, sizeof(lpCmdLine) );
+    wchar_t lpCmdLine[(strlen (args) + 1) * 3];
+    MultiByteToWideChar (CP_ACP, 0, args, -1, lpCmdLine, sizeof (lpCmdLine));
     return wWinMain (hInstance, hPrevInstance, lpCmdLine, nCmdShow);
 }
 #endif




More information about the vlc-devel mailing list