iplink: validate maximum gso_max_size

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>
This commit is contained in:
Solio Sarabia 2017-12-12 14:25:22 -08:00 committed by Stephen Hemminger
parent 3a2fbf007b
commit 051274b4db
2 changed files with 3 additions and 2 deletions

View 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);