naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/iproute2-3.10.0-1139173.patch

a4b897
commit 1ed509bb522225050edfa1ed7ddc7255e9a18bd5
a4b897
Author: Thomas Egerer <thomas.egerer@secunet.com>
a4b897
Date:   Thu Aug 29 14:00:36 2013 +0200
a4b897
a4b897
    ip/xfrm: Fix potential SIGSEGV when printing extra flags
a4b897
    
a4b897
    The git-commit dc8867d0, that added support for displaying the
a4b897
    extra-flags of a state, introduced a potential segfault.
a4b897
    Trying to show a state without the extra-flag attribute and show_stats
a4b897
    enabled, would cause the NULL pointer in tb[XFRMA_SA_EXTRA_FLAGS] to be
a4b897
    dereferenced.
a4b897
    
a4b897
    Signed-off-by: Thomas Egerer <thomas.egerer@secunet.com>
a4b897
a4b897
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
a4b897
index 0a3a9fb..411d9d5 100644
a4b897
--- a/ip/ipxfrm.c
a4b897
+++ b/ip/ipxfrm.c
a4b897
@@ -856,7 +856,7 @@ void xfrm_state_info_print(struct xfrm_usersa_info *xsinfo,
a4b897
 		if (flags)
a4b897
 			fprintf(fp, "%x", flags);
a4b897
 	}
a4b897
-	if (show_stats > 0 || tb[XFRMA_SA_EXTRA_FLAGS]) {
a4b897
+	if (show_stats > 0 && tb[XFRMA_SA_EXTRA_FLAGS]) {
a4b897
 		__u32 extra_flags = *(__u32 *)RTA_DATA(tb[XFRMA_SA_EXTRA_FLAGS]);
a4b897
 
a4b897
 		fprintf(fp, "extra_flag ");