Merge pull request #2403 from facebook/no_strncpy

fix gcc10 warnings
dev
Yann Collet 2020-11-30 06:30:26 -08:00 committed by GitHub
commit 1126ad58b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

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