[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1364221399-1024-4-git-send-email-david.ward@ll.mit.edu>
Date: Mon, 25 Mar 2013 10:23:16 -0400
From: David Ward <david.ward@...mit.edu>
To: <netdev@...r.kernel.org>
CC: David Ward <david.ward@...mit.edu>
Subject: [PATCH iproute2 4/7] ip/xfrm: Do not print a zero-length algorithm key
Signed-off-by: David Ward <david.ward@...mit.edu>
---
ip/ipxfrm.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/ip/ipxfrm.c b/ip/ipxfrm.c
index 2576938..3113573 100644
--- a/ip/ipxfrm.c
+++ b/ip/ipxfrm.c
@@ -536,12 +536,14 @@ static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
goto fin;
}
- fprintf(fp, "0x");
- for (i = 0; i < keylen; i ++)
- fprintf(fp, "%.2x", (unsigned char)algo->alg_key[i]);
+ if (keylen > 0) {
+ fprintf(fp, "0x");
+ for (i = 0; i < keylen; i ++)
+ fprintf(fp, "%.2x", (unsigned char)algo->alg_key[i]);
- if (show_stats > 0)
- fprintf(fp, " (%d bits)", algo->alg_key_len);
+ if (show_stats > 0)
+ fprintf(fp, " (%d bits)", algo->alg_key_len);
+ }
fin:
if (newline)
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists