mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-10-05 09:21:05 +00:00
tc_util: detect overflow in get_size
This detects overflow during parsing of value using get_size: eg. running: $ tc qdisc add dev lo root cake memlimit 11gb currently gives a memlimit of "3072Mb", while with this patch it errors with 'illegal value for "memlimit": "11gb"', since memlinit is an unsigned integer. Signed-off-by: Odin Ugedal <odin@ugedal.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
fe821d64e6
commit
e07c57e94e
@ -385,6 +385,11 @@ int get_size(unsigned int *size, const char *str)
|
||||
}
|
||||
|
||||
*size = sz;
|
||||
|
||||
/* detect if an overflow happened */
|
||||
if (*size != floor(sz))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user