]> granicus.if.org Git - curl/commitdiff
unit1650: fix "null pointer passed as argument 1 to memcmp"
authorDaniel Stenberg <daniel@haxx.se>
Mon, 29 Oct 2018 09:27:04 +0000 (10:27 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 29 Oct 2018 15:14:40 +0000 (16:14 +0100)
Detected by UndefinedBehaviorSanitizer

Closes #3187

tests/unit/unit1650.c

index 723c0642168753e8b8a2363e1935179d39a995c6..ddf228f8d9acd2baa2165521e41c09f1eeca7675 100644 (file)
@@ -170,7 +170,7 @@ UNITTEST_START
       fprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
       return 2;
     }
-    else if(memcmp(req[i].packet, buffer, size)) {
+    else if(req[i].packet && memcmp(req[i].packet, buffer, size)) {
       fprintf(stderr, "DNS encode made: %s\n", hexdump(buffer, size));
       fprintf(stderr, "... instead of: %s\n",
              hexdump((unsigned char *)req[i].packet, size));