]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink: validate maximum gso_max_size
authorSolio Sarabia <solio.sarabia@intel.com>
Tue, 12 Dec 2017 22:25:22 +0000 (14:25 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 15 Dec 2017 02:12:14 +0000 (18:12 -0800)
Validate the upper limit for gso_max_size, valid range is [0-65,536]
inclusive. Fix minor whitespace in iplink man page.

Signed-off-by: Solio Sarabia <solio.sarabia@intel.com>
ip/iplink.c
man/man8/ip-link.8.in

index 6379b16a14f559cc534261db68a49e765cd76a8d..62bf713d4ba26e5085b9e79ad2b488d8be52c6d7 100644 (file)
@@ -853,7 +853,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
                        unsigned int max_size;
 
                        NEXT_ARG();
-                       if (get_unsigned(&max_size, *argv, 0) || max_size > UINT16_MAX)
+                       if (get_unsigned(&max_size, *argv, 0) ||
+                               max_size > UINT16_MAX + 1)
                                invarg("Invalid \"gso_max_size\" value\n",
                                       *argv);
                        addattr32(&req->n, sizeof(*req), IFLA_GSO_MAX_SIZE, max_size);
index 0db2582e19f7a62a5e2e36a442b94d949cc73e0f..40f09b30ea3a0f2630e1ba15e649402abd3fde3a 100644 (file)
@@ -36,7 +36,7 @@ ip-link \- network device configuration
 .RB "[ " numrxqueues
 .IR QUEUE_COUNT " ]"
 .br
-.BR "[" gso_max_size
+.BR "[ " gso_max_size
 .IR BYTES " ]"
 .RB "[ " gso_max_segs
 .IR SEGMENTS " ]"