Fixed the allocation of the buffer for the environment variable in ProcessInput. Modified: trunk/reactos/subsys/system/cmd/cmd.c _____
Modified: trunk/reactos/subsys/system/cmd/cmd.c --- trunk/reactos/subsys/system/cmd/cmd.c 2005-07-13 17:32:39 UTC (rev 16556) +++ trunk/reactos/subsys/system/cmd/cmd.c 2005-07-13 17:59:37 UTC (rev 16557) @@ -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)