[ros-diffs] [navaraf] 17006: Merge 16557 (hbirr) from trunk:

navaraf at svn.reactos.com navaraf at svn.reactos.com
Wed Aug 3 18:11:05 CEST 2005


Merge 16557 (hbirr) from trunk:
Fixed the allocation of the buffer for the environment variable in
ProcessInput.
Modified: branches/ros-branch-0_2_7/reactos/subsys/system/cmd/cmd.c
  _____  

Modified: branches/ros-branch-0_2_7/reactos/subsys/system/cmd/cmd.c
--- branches/ros-branch-0_2_7/reactos/subsys/system/cmd/cmd.c
2005-08-03 16:10:03 UTC (rev 17005)
+++ branches/ros-branch-0_2_7/reactos/subsys/system/cmd/cmd.c
2005-08-03 16:11:00 UTC (rev 17006)
@@ -1061,18 +1061,19 @@

               }               
 							else 
               {
-                evar = malloc ( size * sizeof(TCHAR));
+                evar = malloc ( 512 * sizeof(TCHAR));
                 if (evar==NULL) 
                     return 1; 
 
-                size = GetEnvironmentVariable (ip, evar, size);
-                if (size!=0)
+                size = GetEnvironmentVariable (ip, evar, 512);
+                if (size > 512)
                 {
                     evar = realloc(evar,size * sizeof(TCHAR) );
-                    if (evar!=NULL)
+                    if (evar==NULL)
                     {
-                      size = GetEnvironmentVariable (ip, evar, size);
+                      return 1;
                     }
+                    size = GetEnvironmentVariable (ip, evar, size);
                 }
 
                 if (size)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050803/3d27b53e/attachment.html


More information about the Ros-diffs mailing list