From fed1c625715adb608bae57a7cd55e8b20cfd2958 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Mon, 30 Nov 2020 04:44:37 -0800 Subject: [PATCH] fix gcc10 warnings gcc10 doesn't like its own strncpy --- programs/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/util.c b/programs/util.c index 980ab5a4..5386d005 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;