[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1241103050.19807.34.camel@amd64.fatal.se>
Date: Thu, 30 Apr 2009 16:50:50 +0200
From: Andreas Henriksson <andreas@...al.se>
To: Timothy Baldwin <T.E.Baldwin99@...bers.leeds.ac.uk>,
526329@...s.debian.org, Stephen Hemminger <shemminger@...tta.com>
Cc: netdev <netdev@...r.kernel.org>
Subject: [PATCH] Bug#526329: iproute: Segfault on garbage lladdr
On tor, 2009-04-30 at 14:32 +0100, Timothy Baldwin wrote:
> Package: iproute
> Version: 20090324-1
> Severity: minor
>
>
> $ ip link set eth0 address help
> "help" is invalid lladdr.
> Segmentation fault
>
> Desipte the invalid command line arguments it shouldn't crash.
>
Callers need to check return value from ll_addr_a2n(). Patch below.
Signed-off-by: Andreas Henriksson <andreas@...al.se>
diff --git a/ip/iplink.c b/ip/iplink.c
index 237ea82..55558e3 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -200,11 +200,15 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
} else if (matches(*argv, "address") == 0) {
NEXT_ARG();
len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
+ if (len < 0)
+ return -1;
addattr_l(&req->n, sizeof(*req), IFLA_ADDRESS, abuf, len);
} else if (matches(*argv, "broadcast") == 0 ||
strcmp(*argv, "brd") == 0) {
NEXT_ARG();
len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
+ if (len < 0)
+ return -1;
addattr_l(&req->n, sizeof(*req), IFLA_BROADCAST, abuf, len);
} else if (matches(*argv, "txqueuelen") == 0 ||
strcmp(*argv, "qlen") == 0 ||
--
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