]> granicus.if.org Git - libevent/commitdiff
test: do not pass NULL to memcmp() in evbuffer_datacmp() helper
authorAzat Khuzhin <azat@libevent.org>
Thu, 25 Jun 2020 06:59:35 +0000 (09:59 +0300)
committerAzat Khuzhin <azat@libevent.org>
Thu, 25 Jun 2020 06:59:35 +0000 (09:59 +0300)
Fixes:
  runtime error: null pointer passed as argument 2, which is declared to never be null

test/regress_http.c

index 279dcd4df2196bb0d090c025e1158babd4e22adc..4353ca5f14fbcb79367f6df81b1f9ea31c92843d 100644 (file)
@@ -267,6 +267,8 @@ evbuffer_datacmp(struct evbuffer *buf, const char *s)
                return -1;
 
        d = evbuffer_pullup(buf, s_sz);
+       if (!d)
+               d = (unsigned char *)"";
        if ((r = memcmp(d, s, s_sz)))
                return r;