build: avoid compilation warnings by using memcpy() instead of strncpy()

When compiling with GCC 10.1.0 and -O2 -Wall, the strncpy() call
in measured_copy() produced two stringop-truncation warnings.

This addresses https://savannah.gnu.org/bugs/?58861.

Signed-off-by: Michalis Kokologiannakis <michalis@mpi-sws.org>
master
Michalis Kokologiannakis 2020-07-31 11:40:27 +03:00 committed by Benno Schulenberg
parent 7942dab014
commit 4940b02ae0
1 changed files with 1 additions and 1 deletions

View File

@ -330,7 +330,7 @@ char *measured_copy(const char *string, size_t count)
{
char *thecopy = charalloc(count + 1);
strncpy(thecopy, string, count);
memcpy(thecopy, string, count);
thecopy[count] = '\0';
return thecopy;