]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
ip: validate vlan value for vlan info
authorStephen Hemminger <stephen@networkplumber.org>
Fri, 15 Dec 2017 02:17:43 +0000 (18:17 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 16 Dec 2017 21:14:38 +0000 (13:14 -0800)
The VLAN tag must be 0..4095 to be valid.
Better to trap it here.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/iplink.c

index e83f1477e7bc3a783692702a7618c32425126454..1e685cc23805060a688152fa2f137cd401935854 100644 (file)
@@ -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);