Skip to contentSkip to conversation

ip segfault with wrong key

PATCH In review Marcela Maslanova 2 participants 2 messages Jul 4, 2008 – Jul 8, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip segfault with wrong key

Wrong key in "ip xfrm state" command lead to segfault. I thought there could be used only hexadecimal numbers. I'm suggesting attached patch. The example of problem could be seen here: https://bugzilla.redhat.com/show_bug.cgi?id=449933

Signature · 2 lines
Marcela Mašláňová
BaseOS team Brno
Quoted 1 line

From e2ea8623c5d4fb761924cb7744a0bb220b65e03e Mon Sep 17 00:00:00 2001

From: =?utf-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= <[email protected]>
Date: Fri, 4 Jul 2008 13:38:17 +0200
Subject: [PATCH] The key should be hexadecimal number. This fix should solve
segfault with wrong key.

---
 ip/xfrm_state.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
ip/xfrm_state.c +3 -2
index ff309e7..9a34da4 100644
@@ -160,8 +160,9 @@ static int xfrm_algo_parse(struct xfrm_algo *alg, enum xfrm_attr_type_t type,
 		if (len > 0) {
 			if (len > max)
 				invarg("\"ALGOKEY\" makes buffer overflow\n", key);
-
-			strncpy(alg->alg_key, key, len);
+			else
+				invarg("\"ALGOKEY\" is invalid", key);
+			/* strncpy(alg->alg_key, key, len); */
 		}
 	}
 
Signature · 1 line
1.5.5.1
#1 lore raw
Quoted 5 lines · Marcela Maslanova

Wrong key in "ip xfrm state" command lead to segfault. I thought there could be used only hexadecimal numbers. I'm suggesting attached patch. The example of problem could be seen here:
https://bugzilla.redhat.com/show_bug.cgi?id=449933

I don't see why we should disallow string keys. Let's treat the disease instead of chopping off limbs.

Cheers,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt