From 486636c37bcd5c1f056882a05676ca00a8b551c9 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Fri, 15 Jul 2005 18:18:40 +0000 Subject: [PATCH] did forget check malloc and realloc was NULL and set size to zero. thx w3seek that did see this mistake svn path=/trunk/; revision=16586 --- reactos/subsys/system/cmd/copy.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/reactos/subsys/system/cmd/copy.c b/reactos/subsys/system/cmd/copy.c index 4b1e94d2a34..4613e856647 100644 --- a/reactos/subsys/system/cmd/copy.c +++ b/reactos/subsys/system/cmd/copy.c @@ -275,15 +275,22 @@ INT cmd_copy (LPTSTR cmd, LPTSTR param) /* Get the envor value if it exists */ evar = malloc(512); - size = GetEnvironmentVariable (_T("COPYCMD"), evar, 512); - if (size > 512) + if (evar==NULL) size = 0; + + size = GetEnvironmentVariable (_T("COPYCMD"), evar, 512); + if ((size > 1) && (size > 512)) { evar = realloc(evar,size * sizeof(TCHAR) ); if (evar!=NULL) { size = GetEnvironmentVariable (_T("COPYCMD"), evar, size); } + else + { + size=0; + } } + /* check see if we did get any env variable */ if (size !=0) {