[PATCH ipset 2/2] lib: don't segfault when ipset_data_get returns NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ipset_data_get returns NULL if the attribute is not available, causes when
running 'ipset list':

$ ipset -N foo hash:ip
$ ipset list
Segmentation fault (core dumped)

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 Not sure about this patch, the missing attr is IPSET_OPT_MEMSIZE.
 Is the kernel supposed to send it along (i am on latest nf tree)?

diff --git a/lib/print.c b/lib/print.c
index f81c074..9ad4bab 100644
--- a/lib/print.c
+++ b/lib/print.c
@@ -378,6 +378,8 @@ ipset_print_number(char *buf, unsigned int len,
 	assert(data);
 
 	number = ipset_data_get(data, opt);
+	if (!number)
+		return 0;
 	maxsize = ipset_data_sizeof(opt, AF_INET);
 	D("opt: %u, maxsize %zu", opt, maxsize);
 	if (maxsize == sizeof(uint8_t))
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux