Re: [PATCH nft 1/3] parser: don't mark "string" as const

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

 



On Thu, 2023-11-09 at 20:22 +0100, Pablo Neira Ayuso wrote:
> On Thu, Nov 09, 2023 at 07:59:47PM +0100, Thomas Haller wrote:
> > The "string" field is allocated, and the bison actions are expected
> > to
> > take/free them. It's not const, and it should not be freed with
> > free_const().
> 
> This ifname_expr_alloc() function does not modify the 'name'
> argument,
> this is really const.

ifname_expr_alloc() calls `free(name)`, destroying the thing that is
pointed at. That's a modification.

The code required to cast away the constness, which also indicates that
it is not actually const.


Thomas





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

  Powered by Linux