]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip/xfrm: Fix potential SIGSEGV when printing extra flags
authorThomas Egerer <thomas.egerer@secunet.com>
Thu, 29 Aug 2013 12:00:36 +0000 (14:00 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 31 Aug 2013 17:33:21 +0000 (10:33 -0700)
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

index 0a3a9fb6117e60c9be747ede1e66f928a953857c..411d9d5363ecb240b4475b0eee9f66c78a965f52 100644 (file)
@@ -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 ");