fix potential null pointer deref when packets are forged
[project/mdnsd.git] / cache.c
diff --git a/cache.c b/cache.c
index cdc4a79..812478e 100644 (file)
--- a/cache.c
+++ b/cache.c
@@ -167,7 +167,7 @@ cache_record_find(char *record, int type, int port, int rdlength, uint8_t *rdata
        if (!l)
                return NULL;
 
-       while (l && !strcmp(l->record, record)) {
+       while (l && l->record && !strcmp(l->record, record)) {
                struct cache_record *r = l;
 
                l = avl_next_element(l, avl);