netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft 1/3] src: erec: fall back to internal location if its null
Date: Sun, 21 Jul 2019 02:14:05 +0200	[thread overview]
Message-ID: <20190721001406.23785-2-fw@strlen.de> (raw)
In-Reply-To: <20190721001406.23785-1-fw@strlen.de>

This should never happen (we should pass valid locations to the error
reporting functions), but in case we screw up we will segfault during
error reporting.

cat crash
table inet filter {
}
table inet filter {
      chain test {
        counter
    }
}
"nft -f crash" Now reports:
internal:0:0-0: Error: No such file or directory

... which is both bogus and useless, but better than crashing.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 src/erec.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/erec.c b/src/erec.c
index c550a596b38c..28197924a82c 100644
--- a/src/erec.c
+++ b/src/erec.c
@@ -92,6 +92,9 @@ void erec_print(struct output_ctx *octx, const struct error_record *erec,
 	FILE *f;
 	int l;
 
+	if (!indesc)
+		indesc = &internal_indesc;
+
 	switch (indesc->type) {
 	case INDESC_BUFFER:
 	case INDESC_CLI:
-- 
2.21.0


  reply	other threads:[~2019-07-21  0:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-21  0:14 [PATCH nft 0/3] fix crash bug during rule restore Florian Westphal
2019-07-21  0:14 ` Florian Westphal [this message]
2019-07-21 18:46   ` [PATCH nft 1/3] src: erec: fall back to internal location if its null Pablo Neira Ayuso
2019-07-21 18:50     ` Florian Westphal
2019-07-23 19:19   ` Pablo Neira Ayuso
2019-07-21  0:14 ` [PATCH nft 2/3] src: evaluate: don't rely on global chain ctx for error reporting Florian Westphal
2019-07-21  0:14 ` [PATCH nft 3/3] src: evaluate: return immediately if no op was requested Florian Westphal
2019-07-21 18:49   ` Pablo Neira Ayuso
2019-07-21 18:50     ` Florian Westphal
2019-07-22 21:25       ` Pablo Neira Ayuso
2019-07-23 13:11         ` Phil Sutter
2019-07-23 13:52           ` Pablo Neira Ayuso
2019-07-23 19:18   ` Pablo Neira Ayuso
2019-07-23 22:44     ` Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190721001406.23785-2-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).