nft: nft_set_attr_get_u32 null pointer deref
PATCH 1/1 nft: nft_set_attr_get_u32 null pointer deref
As reported by John Sager, nft_set_attr_get_u32 can cause a segfault because nft_set_attr_get can return NULL. Check for a non-NULL pointer before dereferencing.
This closes netfilter bugzilla #868.
src/set.c +2 -2
@@ -183,8 +183,8 @@ EXPORT_SYMBOL(nft_set_attr_get_str);uint32_t nft_set_attr_get_u32 (struct nft_set *s,uint16_t attr) { -uint32_t val = *((uint32_t *)nft_set_attr_get (s, attr)); -return val; +const void *val =nft_set_attr_get (s, attr); +return val ? *(uint32_t *)val :0 ; }EXPORT_SYMBOL (nft_set_attr_get_u32);
Quoted 5 lines · Phil Oester
As reported by John Sager,
nft_set_attr_get_u32can cause a segfault becausenft_set_attr_getcan return NULL. Check for a non-NULL pointer before dereferencing.This closes netfilter bugzilla #868.
I have mangled this patch to include possible null dereferences in get operations with rule objects (similar case). Let me know if you see any issue with my change.
Applied, thanks.
Quoted 3 lines · Pablo Neira Ayuso
I have mangled this patch to include possible null dereferences in get operations with rule objects (similar case). Let me know if you see any issue with my change.
Looks good, thanks.
Phil