diff options
author | Arturo Borrero <arturo.borrero.glez@gmail.com> | 2016-05-11 13:30:13 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-05-13 11:35:48 +0200 |
commit | 6d91c4d176c3235371333abc6044ad90bea21d6d (patch) | |
tree | 826f0dd046165de4a8dbd37e6b46bf2a6d2e98f2 /tests/shell | |
parent | 901349884473fb7c2e261b555e3f347cd2419ece (diff) |
tests/shell: add testcase to catch segfault if invalid syntax was used
This helps to catch 5afa5a1 ("evaluate: check for NULL datatype in rhs
in lookup expr").
Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell')
-rwxr-xr-x | tests/shell/testcases/nft-f/0007action_object_set_segfault_1 | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 b/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 new file mode 100755 index 00000000..3a4183bb --- /dev/null +++ b/tests/shell/testcases/nft-f/0007action_object_set_segfault_1 @@ -0,0 +1,21 @@ +#!/bin/bash + +# test for a segfault if bad syntax was used in set declaration +# and the set is referenced in the same batch + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -f $tmpfile" EXIT # cleanup if aborted + +echo " +add table t +add chain t c +add set t s {type ipv4_addr\;} +add rule t c ip saddr @s +" > $tmpfile + +$NFT -f $tmpfile 2>/dev/null |