From: Jo-Philipp Wich Date: Wed, 19 Aug 2009 21:36:10 +0000 (+0000) Subject: libs/lmo: fix possible null pointer dereference in lmo_lookup() - thanks blogic X-Git-Tag: 0.10.0~1169 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=68f335b8d6e3f96c0e35d2b2021d5995e0f536e7 libs/lmo: fix possible null pointer dereference in lmo_lookup() - thanks blogic --- diff --git a/libs/lmo/src/lmo_core.c b/libs/lmo/src/lmo_core.c index 17467f21e..ab2410f46 100644 --- a/libs/lmo/src/lmo_core.c +++ b/libs/lmo/src/lmo_core.c @@ -207,8 +207,12 @@ int lmo_lookup(lmo_archive_t *ar, const char *key, char *dest, int len) { uint32_t look_key = sfh_hash(key, strlen(key)); int copy_len = -1; + lmo_entry_t *entry; - lmo_entry_t *entry = ar->index; + if( !ar ) + return copy_len; + + entry = ar->index; while( entry != NULL ) {