diff options
author | Harsha Sharma <harshasharmaiitr@gmail.com> | 2018-03-03 13:33:58 +0530 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2018-03-03 10:13:06 +0100 |
commit | 82e732c6e6ae33cd9376fb016fb999704db57674 (patch) | |
tree | af1cb924a09a48b82b8b98aeca71a30bad582bba /src | |
parent | 949cc39eb93fd0fbd7ba712f468281dc349dc8cd (diff) |
libnftables: don't crash when no commands are specified
For e.g. nft -c " "
Without this patch it segfaults.
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/libnftables.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libnftables.c b/src/libnftables.c index c86d8947..1d1975e9 100644 --- a/src/libnftables.c +++ b/src/libnftables.c @@ -30,6 +30,9 @@ static int nft_netlink(struct nft_ctx *nft, bool batch_supported = netlink_batch_supported(nf_sock, &seqnum); int ret = 0; + if (list_empty(&state->cmds)) + return 0; + batch = mnl_batch_init(); batch_seqnum = mnl_batch_begin(batch, mnl_seqnum_alloc(&seqnum)); |