]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
fix bug #289: use strcpy instead of strncpy 294/head
authorSebastian Pop <s.pop@samsung.com>
Tue, 22 Jan 2019 19:46:34 +0000 (13:46 -0600)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 24 Jan 2019 11:50:49 +0000 (12:50 +0100)
to avoid a GCC 8 warning:

test/example.c:465:48: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
     strncpy((char*)uncompr, garbage_str, sizeof(garbage_str));

test/example.c

index e11bd2e925e9991c280c88c87cb7ca369db5cb7b..7567fc5d2ff7de1bd70192cf2229efd1528504c8 100644 (file)
@@ -461,8 +461,7 @@ void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *unc
     int err;
     PREFIX3(stream) d_stream; /* decompression stream */
 
-    char garbage_str[] = "garbage garbage garbage";
-    strncpy((char*)uncompr, garbage_str, sizeof(garbage_str));
+    strcpy((char*)uncompr, "garbage garbage garbage");
 
     d_stream.zalloc = zalloc;
     d_stream.zfree = zfree;