Fixed data copying in msvcrt_argvtos (spotted by bill@taniwha.org).

This commit is contained in:
Alexandre Julliard 2002-11-13 04:20:54 +00:00
parent b1c3a89ade
commit 2b6eafa0f9
1 changed files with 5 additions and 3 deletions

View File

@ -131,12 +131,13 @@ static char* msvcrt_argvtos(const char* const* arg, char delim)
while (*a) while (*a)
{ {
int len = strlen(*a); int len = strlen(*a);
memcpy(ret+size,*a,len); memcpy(p,*a,len);
p += len; p += len;
*p++ = delim; *p++ = delim;
a++; a++;
} }
*p='\0'; if (delim && p > ret) p[-1] = 0;
else *p = 0;
return ret; return ret;
} }
@ -189,7 +190,8 @@ static char* msvcrt_valisttos(const char* arg0, va_list alist, char delim)
*p++ = delim; *p++ = delim;
arg = va_arg(alist2, char*); arg = va_arg(alist2, char*);
} while (arg != NULL); } while (arg != NULL);
*p = '\0'; if (delim && p > ret) p[-1] = 0;
else *p = 0;
return ret; return ret;
} }