From 14569005ceedc6c2ce34526b8a6ac6778938aa47 Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Mon, 28 Jul 2014 13:54:26 +0200 Subject: [PATCH] xtypes: overflow detection updated --- ucw/table-types.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ucw/table-types.c b/ucw/table-types.c index 84d317c2..4da3ccc8 100644 --- a/ucw/table-types.c +++ b/ucw/table-types.c @@ -117,10 +117,9 @@ static const char *xt_size_parse(const char *str, void *dest, struct mempool *po return mp_printf(pool, "Invalid units: '%s'.", str); } - // FIXME: Detect overflow? + // Overflow detection u64 num = xt_size_units[unit_idx].num; - if((parsed && UINT64_MAX / parsed < num) || - (num && UINT64_MAX / num < parsed)) { + if(parsed && UINT64_MAX / parsed < num) { return mp_printf(pool, "Size too large: '%s'.", str); } -- 2.39.2