]> git.ipfire.org Git - thirdparty/nftables.git/commit
parser: fix crash if we add a chain with an error chain type
authorLiping Zhang <liping.zhang@spreadtrum.com>
Sun, 29 May 2016 11:25:37 +0000 (19:25 +0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 30 May 2016 09:55:47 +0000 (11:55 +0200)
commit1f327272e968a72de2d2a56da69124b40aa38744
treee222b62fee92706cbd94226767b135e9e0fbcc06
parentd73b6b39f66ff477831e69f40e47fb7faa426ce3
parser: fix crash if we add a chain with an error chain type

If we add a chain and specify the nonexistent chain type, chain_type_name_lookup
will return a NULL pointer, and meet the assert condition in xstrdup.
Fix crash like this:

  # nft add chain filter input {type none hook input priority 0\;}
  nft: utils.c:63: xstrdup: Assertion `s != ((void *)0)' failed.
  Aborted (core dumped)

Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_bison.y