diff options
author | Phil Sutter <phil@nwl.cc> | 2022-08-30 15:00:52 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2022-08-30 15:38:05 +0200 |
commit | 5472143922531e0f7ea2770b302903f5002472df (patch) | |
tree | 6bda2bfcfd81e92e119fb82e655ceba1bbf72541 /src | |
parent | a83ccf85fcad7383236aeb5b75490831edfdcd28 (diff) |
erec: Dump locations' expressions only if set
Calling netlink_dump_expr() with a NULL pointer leads to segfault within
libnftnl. Internal ("fake") locations such as 'netlink_location' don't
have an expression assigned so expect this and skip the call. Simple
reproducer (list ruleset with netlink debugging as non-root):
| $ nft -d netlink list ruleset
Reported-by: François Rigault <frigo@amadeus.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src')
-rw-r--r-- | src/erec.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -170,6 +170,8 @@ void erec_print(struct output_ctx *octx, const struct error_record *erec, fprintf(f, "%s\n", erec->msg); for (l = 0; l < (int)erec->num_locations; l++) { loc = &erec->locations[l]; + if (!loc->nle) + continue; netlink_dump_expr(loc->nle, f, debug_mask); } return; |