[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20171215021918.21986-1-stephen@networkplumber.org>
Date: Thu, 14 Dec 2017 18:19:18 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: netdev@...r.kernel.org
Cc: Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute] ip: validate vlan value for vlan info
The VLAN tag must be 0..4095 to be valid.
Better to trap it here.
Signed-off-by: Stephen Hemminger <stephen@...workplumber.org>
---
ip/iplink.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ip/iplink.c b/ip/iplink.c
index e83f1477e7bc..1e685cc23805 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -276,11 +276,13 @@ static void iplink_parse_vf_vlan_info(int vf, int *argcp, char ***argvp,
{
int argc = *argcp;
char **argv = *argvp;
+ unsigned int vci;
NEXT_ARG();
- if (get_unsigned(&ivvip->vlan, *argv, 0))
+ if (get_unsigned(&vci, *argv, 0) || vci > 4095)
invarg("Invalid \"vlan\" value\n", *argv);
+ ivvip->vlan = vci;
ivvip->vf = vf;
ivvip->qos = 0;
ivvip->vlan_proto = htons(ETH_P_8021Q);
--
2.11.0
Powered by blists - more mailing lists