fix gcc10 warnings

gcc10 doesn't like its own strncpy
This commit is contained in:
Yann Collet 2020-11-30 04:44:37 -08:00
parent e0ec32f1e3
commit fed1c62571

View File

@ -788,7 +788,7 @@ static char* mallocAndJoin2Dir(const char *dir1, const char *dir2)
outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2); outDirBuffer = (char *) malloc(dir1Size + dir2Size + 2);
CONTROL(outDirBuffer != NULL); CONTROL(outDirBuffer != NULL);
strncpy(outDirBuffer, dir1, dir1Size); memcpy(outDirBuffer, dir1, dir1Size);
outDirBuffer[dir1Size] = '\0'; outDirBuffer[dir1Size] = '\0';
if (dir2[0] == '.') if (dir2[0] == '.')
@ -800,7 +800,7 @@ static char* mallocAndJoin2Dir(const char *dir1, const char *dir2)
*buffer = PATH_SEP; *buffer = PATH_SEP;
buffer++; buffer++;
} }
strncpy(buffer, dir2, dir2Size); memcpy(buffer, dir2, dir2Size);
buffer[dir2Size] = '\0'; buffer[dir2Size] = '\0';
return outDirBuffer; return outDirBuffer;