diff mbox

[nft,3/3] tests/shell: add testcase to catch segfault if invalid syntax was used

Message ID 146296621327.3706.18265491927507888269.stgit@nfdev2.cica.es
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero May 11, 2016, 11:30 a.m. UTC
Let's add

Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 .../nft-f/0007action_object_set_segfault_1         |   21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 tests/shell/testcases/nft-f/0007action_object_set_segfault_1


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso May 13, 2016, 9:40 a.m. UTC | #1
On Wed, May 11, 2016 at 01:30:13PM +0200, Arturo Borrero Gonzalez wrote:
> Let's add

Applied.

I have included in the commit log message that this refers to
"evaluate: check for NULL datatype in rhs in lookup expr".
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arturo Borrero May 13, 2016, 10:29 a.m. UTC | #2
On 13 May 2016 at 11:40, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Wed, May 11, 2016 at 01:30:13PM +0200, Arturo Borrero Gonzalez wrote:
>> Let's add
>
> Applied.
>
> I have included in the commit log message that this refers to
> "evaluate: check for NULL datatype in rhs in lookup expr".

Oops, thanks, my fault.
diff mbox

Patch

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 0000000..3a4183b
--- /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