From: Yann Collet Date: Mon, 30 Nov 2020 12:44:37 +0000 (-0800) Subject: fix gcc10 warnings X-Git-Tag: v1.4.7~27^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2403%2Fhead;p=thirdparty%2Fzstd.git fix gcc10 warnings gcc10 doesn't like its own strncpy --- diff --git a/programs/util.c b/programs/util.c index 980ab5a42..5386d005c 100644 --- a/programs/util.c +++ b/programs/util.c @@ -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;