Re: [PATCH nft] parser_json: fix segfault in translating string to nft object

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

 



Hi,

On Thu, Apr 11, 2019 at 11:15:58AM +0200, Florian Westphal wrote:
> Laura Garcia Liebana <nevola@xxxxxxxxx> wrote:
> > The obj_tbl array is allocated with the maximum element index even
> > if lower indexes are not populated, so it produces null pointer
> > items.
> > 
> > This patch ensures that the maximum number of possible indexes
> > but also the element is not comparing a null pointer.
> 
> Applied, thanks Laura.

Thanks for catching this, Laura!

> >  static int string_to_nft_object(const char *str)
> >  {
> > -	const char *obj_tbl[] = {
> > +	const char *obj_tbl[__NFT_OBJECT_MAX] = {
> >  		[NFT_OBJECT_COUNTER] = "counter",
> >  		[NFT_OBJECT_QUOTA] = "quota",
> >  		[NFT_OBJECT_CT_HELPER] = "ct helper",
> >  		[NFT_OBJECT_LIMIT] = "limit",
> >  		[NFT_OBJECT_SECMARK] = "secmark",
> >  	};
> 
> Phil, does this need updating?
> 
> It looks to me as if this should also init NFT_OBJECT_CT_TIMEOUT and so on.

Actually, it is not strict enough. The function is used when handling
'add map' command. In bison, only counter, quota, limit and secmark are
allowed as stateful object "destination". I suspect ct helper is a
leftover from reusing the function somewhere else. I'll send a patch to
remove it.

Cheers, Phil



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux