[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4467313.PgxQL6MHJm@tuxracer>
Date: Wed, 11 Dec 2013 14:25:10 +0200
From: Sergey Popovich <popovich_sergei@...l.ru>
To: netdev@...r.kernel.org
Subject: [PATCH 1/2] Initialize arguments to iplink_parse() by default
Be consistent when dealing with arguments passed
to iplink_parse() by initializing to default values.
This fixes crash when ip-link(8) invoced with command:
ip link add dev veth1a type veth peer
Signed-off-by: Sergey Popovich <popovich_sergei@...l.ru>
---
ip/iplink.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index 58b6c20..9735c54 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -299,6 +299,7 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
int numtxqueues = -1;
int numrxqueues = -1;
+ *name = *type = *link = *dev = NULL;
*group = -1;
ret = argc;
@@ -498,15 +499,11 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
{
- int len;
- char *dev = NULL;
- char *name = NULL;
- char *link = NULL;
- char *type = NULL;
+ char *name, *type, *link, *dev;
int group;
struct link_util *lu = NULL;
struct iplink_req req;
- int ret;
+ int len, ret;
memset(&req, 0, sizeof(req));
--
1.7.10.4
--
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