]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fixed wrong size being used in calloc in test_deflate_set_header.
authorNathan Moinvaziri <nathan@nathanm.com>
Sun, 28 Jun 2020 20:32:00 +0000 (13:32 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 29 Jun 2020 15:55:51 +0000 (17:55 +0200)
    CID 293478 (#1 of 1): Wrong size argument (SIZEOF_MISMATCH)
    suspicious_sizeof: Passing argument 1UL to function calloc that returns a pointer of type zng_gz_header * is suspicious because a multiple of sizeof (zng_gz_header) /*80*/ is expected.

test/example.c

index a47155ffa1d8299a0823b1dd6ab0065f5da8d47d..93ecda736d7a622155397712c4e96b2fc96b3a59 100644 (file)
@@ -855,7 +855,7 @@ void test_deflate_prime(unsigned char *compr, size_t comprLen) {
  * Test deflateSetHeader() with small buffers
  */
 void test_deflate_set_header(unsigned char *compr, size_t comprLen) {
-    PREFIX(gz_header) *head = calloc(256, 1);
+    PREFIX(gz_header) *head = calloc(1, sizeof(PREFIX(gz_header)));
     PREFIX3(stream) c_stream; /* compression stream */
     int err;
     size_t len = strlen(hello)+1;