[Bug 940] New: - msvcrt_argvtos not building args properly

wine-bugs at winehq.com wine-bugs at winehq.com
Fri Aug 2 19:18:02 CDT 2002


http://bugs.winehq.com/show_bug.cgi?id=940

           Summary: msvcrt_argvtos not building args properly
           Product: Wine
           Version: CVS
          Platform: PC
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-kernel
        AssignedTo: wine-bugs at winehq.com
        ReportedBy: bill at taniwha.org


msvcrt_argvtos is copying the data incorrectly. the args are all being copied to
past the end of the allocated buffer and all to the same location. Here's a
patch to fix it:

Index: dlls/msvcrt/process.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/process.c,v
retrieving revision 1.12
diff -u -r1.12 process.c
--- dlls/msvcrt/process.c       19 Jul 2002 03:24:50 -0000      1.12
+++ dlls/msvcrt/process.c       3 Aug 2002 00:16:11 -0000
@@ -117,7 +117,7 @@
     a++;
   }
 
-  ret = (char*)MSVCRT_malloc(size + 1);
+  ret = (char*)MSVCRT_malloc(size);
   if (!ret)
     return NULL;
 
@@ -127,12 +127,12 @@
   while (*a)
   {
     int len = strlen(*a);
-    memcpy(ret+size,*a,len);
+    memcpy(p,*a,len);
     p += len;
     *p++ = delim;
     a++;
   }
-  *p='\0';
+  p[-1] ='\0';
   return ret;
 }

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://bugs.winehq.com/show_bug.cgi?id=940>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.



More information about the wine-bugs mailing list