]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Use memcpy instead of strncpy in append_log
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Oct 2018 19:37:57 +0000 (21:37 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 14 Oct 2018 19:37:57 +0000 (21:37 +0200)
We’re copying a known amount of bytes; strncpy is almost never the right
solution.

src/util.c

index 04d0640d86fda16905cedb5d886df6c924336abf..5f4a4b7c4c06ca50f17acda59d52c6c43796c2c8 100644 (file)
@@ -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;
 }