Re: [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]

 



Hi Florian,

On Wed, 12 Feb 2014, Florian Westphal wrote:

> 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)

I'm unable to reproduce it. Please give me more information on the 
environment: architecture, kernel, ipset userspace versions, compiler 
version.
 
> 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)?

How do you know which attr is missing? IPSET_OPT_MEMSIZE should always be
sent by the kernel, look at mtype_head in ip_set_hash_gen.h.

> 
> 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

Best regards,
Jozsef
-
E-mail  : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
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