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 cdc4a792c122cfe7f642ddd38d6d6576d489f19e..812478e44de0664ee17ae0842b39bb674cf0632f 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);