diff options
author | Stuart Reilly <rs576h@vyatta.att-mail.com> | 2019-06-28 16:00:32 +0100 |
---|---|---|
committer | Stuart Reilly <rs576h@vyatta.att-mail.com> | 2019-06-28 16:00:32 +0100 |
commit | bc1b4885de3a80accda894c51c361e2009d54210 (patch) | |
tree | 0c940afc4447ab76fb99d62d87bd045003253d29 | |
parent | 4b717276614e20feada22e6fe29ea2099ba9fd37 (diff) |
Fix potential NULL deref in libcache
-rw-r--r-- | src/lib/third_party/src/libcache.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/third_party/src/libcache.c b/src/lib/third_party/src/libcache.c index 4479ff54d..597684ccc 100644 --- a/src/lib/third_party/src/libcache.c +++ b/src/lib/third_party/src/libcache.c @@ -196,7 +196,11 @@ cache_result cache_add(cache_t cache, void *item, uint32_t item_size) { } if(hash_entry_map_prev) { - hash_entry_map_prev->next = hash_entry_map->next; + if (hash_entry_map) { + hash_entry_map_prev->next = hash_entry_map->next; + } else { + hash_entry_map_prev->next = NULL; + } } else { cache->map[hash] = hash_entry_map->next; } |