commit 4940b02ae016f176ca79f56d4fa4154080922d6d
parent 7942dab01448d21efd4e8d205eee8801e8ea637d
Author: Michalis Kokologiannakis <mixaskok@gmail.com>
Date: Fri, 31 Jul 2020 11:40:27 +0300
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>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/utils.c b/src/utils.c
@@ -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;