From: Joel Rosdahl Date: Sun, 14 Oct 2018 19:37:57 +0000 (+0200) Subject: Use memcpy instead of strncpy in append_log X-Git-Tag: v3.5~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de022dbf7573797f04ca48b2780adef122c1eda1;p=thirdparty%2Fccache.git Use memcpy instead of strncpy in append_log We’re copying a known amount of bytes; strncpy is almost never the right solution. --- diff --git a/src/util.c b/src/util.c index 04d0640d8..5f4a4b7c4 100644 --- a/src/util.c +++ b/src/util.c @@ -76,7 +76,7 @@ append_log(const char *s, size_t len) logbufsize = logbufsize + len + 1 + LOGBUFSIZ; logbuffer = x_realloc(logbuffer, logbufsize); } - strncpy(logbuffer + logsize, s, len); + memcpy(logbuffer + logsize, s, len); logsize += len; }