fixed some botlib strcpy calls with overlapping buffers (UB as per the specs)

This commit is contained in:
myT 2018-01-21 17:29:22 +01:00
parent 4a7f2356ab
commit 4fcf0f410e
3 changed files with 6 additions and 3 deletions

View file

@ -10,6 +10,9 @@ chg: on Windows, a fatal error will move the early console window to the foregro
chg: com_hunkMegs doesn't have a maximum value anymore
a value too high would reset it and the engine might fail to load with the default value
fix: strcpy calls with overlapping buffers (undefined behavior), which were responsible for the
"chars.h not found" / "couldn't load any skills" issue preventing bots from being added
fix: on Linux, the 'Z' and '9' keys could not be bound
fix: cl_allowDownload 1 failing on "connect" (error 10047 on Windows)

View file

@ -863,7 +863,7 @@ void PC_ConvertPath(char *path)
if ((*ptr == '\\' || *ptr == '/') &&
(*(ptr+1) == '\\' || *(ptr+1) == '/'))
{
strcpy(ptr, ptr+1);
memmove(ptr, ptr+1, strlen(ptr));
} //end if
else
{

View file

@ -1109,7 +1109,7 @@ void StripDoubleQuotes(char *string)
{
if (*string == '\"')
{
strcpy(string, string+1);
memmove(string, string+1, strlen(string));
} //end if
string += strlen(string)-1;
if (*string == '\"')
@ -1125,7 +1125,7 @@ void StripSingleQuotes(char *string)
{
if (*string == '\'')
{
strcpy(string, string+1);
memmove(string, string+1, strlen(string));
} //end if
string += strlen(string)-1;
if (*string == '\"')