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
parent
7942dab014
commit
4940b02ae0
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue