fix potential null pointer deref when packets are forged
authorJohn Crispin <blogic@openwrt.org>
Wed, 27 Aug 2014 17:51:07 +0000 (19:51 +0200)
committerJohn Crispin <blogic@openwrt.org>
Wed, 27 Aug 2014 17:51:07 +0000 (19:51 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
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);