From: Daniel Stenberg Date: Mon, 29 Oct 2018 09:27:04 +0000 (+0100) Subject: unit1650: fix "null pointer passed as argument 1 to memcmp" X-Git-Tag: curl-7_62_0~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5728229a4fd209421fdd324dab5fd445d5917508;p=curl unit1650: fix "null pointer passed as argument 1 to memcmp" Detected by UndefinedBehaviorSanitizer Closes #3187 --- diff --git a/tests/unit/unit1650.c b/tests/unit/unit1650.c index 723c06421..ddf228f8d 100644 --- a/tests/unit/unit1650.c +++ b/tests/unit/unit1650.c @@ -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));