All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Egerer <thomas.egerer@secunet.com>
To: netdev@vger.kernel.org
Cc: shemminger@osdl.org
Subject: [PATCH] ip/xfrm: Fix potential SIGSEGV when printing extra flags
Date: Thu, 29 Aug 2013 14:00:36 +0200	[thread overview]
Message-ID: <521F37E4.9030501@secunet.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]


The git-commit dc8867d0, that added support for displaying the
extra-flags of a state, introduced a potential segfault.
Trying to show a state without the extra-flag attribute and show_stats
enabled, would cause the NULL pointer in tb[XFRMA_SA_EXTRA_FLAGS] to be
dereferenced.

Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
---
 ip/ipxfrm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)




[-- Attachment #2: 0001-ip-xfrm-Fix-potential-SIGSEGV-when-printing-extra-fl.patch --]
[-- Type: text/x-patch, Size: 440 bytes --]

diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 0a3a9fb..411d9d5 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -856,7 +856,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
 		if (flags)
 			fprintf(fp, "%x", flags);
 	}
-	if (show_stats > 0 || tb[XFRMA_SA_EXTRA_FLAGS]) {
+	if (show_stats > 0 && tb[XFRMA_SA_EXTRA_FLAGS]) {
 		__u32 extra_flags = *(__u32 *)RTA_DATA(tb[XFRMA_SA_EXTRA_FLAGS]);
 
 		fprintf(fp, "extra_flag ");


                 reply	other threads:[~2013-08-29 12:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=521F37E4.9030501@secunet.com \
    --to=thomas.egerer@secunet.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.