From 80f96ea547babcee8057f9747fd874081225182c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 28 Jul 2018 15:11:22 +0100 Subject: Tests: Passing NULL to memcmp is undefined. test/parse2-auto.c:222:39: runtime error: null pointer passed as argument 2, which is declared to never be null --- test/parse2-auto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/parse2-auto.c b/test/parse2-auto.c index ee717c3..3d4b0e0 100644 --- a/test/parse2-auto.c +++ b/test/parse2-auto.c @@ -219,7 +219,8 @@ void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) dump_sheet(sheet, buf, &buflen); - if (2 * explen - buflen != explen || memcmp(buf, exp, explen) != 0) { + if (2 * explen - buflen != explen || + (explen > 0 && memcmp(buf, exp, explen) != 0)) { printf("Expected (%u):\n%.*s\n", (int) explen, (int) explen, exp); printf("Result (%u):\n%.*s\n", (int) (2 * explen - buflen), -- cgit v1.2.3