Buffer overflow in kernel/process test

Francois Gouget fgouget at free.fr
Fri Nov 7 10:39:55 CST 2003


Changelog:

 * dlls/kernel/tests/process.c

   Fix buffer overflow.
   Fix two -Wwrite-strings warnings (but there are more).


Index: dlls/kernel/tests/process.c
===================================================================
RCS file: /home/cvs/wine/dlls/kernel/tests/process.c,v
retrieving revision 1.12
diff -u -r1.12 process.c
--- dlls/kernel/tests/process.c	16 Sep 2003 01:18:53 -0000	1.12
+++ dlls/kernel/tests/process.c	7 Nov 2003 15:18:16 -0000
@@ -64,7 +64,7 @@

 /* ---------------- simplistic tool to encode/decode strings (to hide \ " ' and such) */

-static char*    encodeA(const char* str)
+static const char* encodeA(const char* str)
 {
     char*       ptr;
     size_t      len,i;
@@ -78,7 +78,7 @@
     return ptr;
 }

-static char*    encodeW(const WCHAR* str)
+static const char* encodeW(const WCHAR* str)
 {
     char*       ptr;
     size_t      len,i;
@@ -286,7 +286,7 @@
         {
             lstrcpynW(env_var, ptrW, MAX_LISTED_ENV_VAR - 1);
             env_var[MAX_LISTED_ENV_VAR - 1] = '\0';
-            childPrintf(hFile, "env%d=%s\n", i, encodeW(ptrW));
+            childPrintf(hFile, "env%d=%s\n", i, encodeW(env_var));
             i++;
             ptrW += lstrlenW(ptrW) + 1;
         }



-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
The nice thing about meditation is that it makes doing nothing quite respectable
                                  -- Paul Dean



More information about the wine-patches mailing list