summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Egerer <thomas.egerer@secunet.com>2013-08-29 14:00:36 +0200
committerStephen Hemminger <stephen@networkplumber.org>2013-08-31 10:33:21 -0700
commit1ed509bb522225050edfa1ed7ddc7255e9a18bd5 (patch)
tree3585174fe007f55dcb34548ffbca0146538474ae
parent7dc0481aa15c96f78079144c52c530c4b8a17f9e (diff)
ip/xfrm: Fix potential SIGSEGV when printing extra flags
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>
-rw-r--r--ip/ipxfrm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 0a3a9fb6..411d9d53 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 ");