netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcela Maslanova <mmaslano@redhat.com>
To: netdev@vger.kernel.org
Cc: shemminger@osdl.org
Subject: [PATCH] [iproute2/ip] ip segfault with wrong key
Date: Fri, 04 Jul 2008 14:33:32 +0200	[thread overview]
Message-ID: <486E189C.2010507@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

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

-- 
Marcela Mašláňová
BaseOS team Brno


[-- Attachment #2: 0001-The-key-should-be-hexadecimal-number.-This-fix-shoul.patch --]
[-- Type: text/x-patch, Size: 850 bytes --]

>From e2ea8623c5d4fb761924cb7744a0bb220b65e03e Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Marcela=20Ma=C5=A1l=C3=A1=C5=88ov=C3=A1?= <mmaslano@redhat.com>
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(-)

diff --git a/ip/xfrm_state.c b/ip/xfrm_state.c
index ff309e7..9a34da4 100644
--- a/ip/xfrm_state.c
+++ b/ip/xfrm_state.c
@@ -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); */
 		}
 	}
 
-- 
1.5.5.1


             reply	other threads:[~2008-07-04 12:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-04 12:33 Marcela Maslanova [this message]
2008-07-08  7:16 ` [PATCH] [iproute2/ip] ip segfault with wrong key Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486E189C.2010507@redhat.com \
    --to=mmaslano@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).