From: Christian Brauner Date: Wed, 17 Jan 2018 11:21:09 +0000 (+0100) Subject: utils: check suffix length X-Git-Tag: lxc-3.0.0.beta1~76^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2229b24f93797b459aba479a80fc4c244f92302;p=thirdparty%2Flxc.git utils: check suffix length Signed-off-by: Christian Brauner --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index cbf16cb62..a20e4b715 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -2412,10 +2412,10 @@ int parse_byte_size_string(const char *s, int64_t *converted) else return -EINVAL; - if ((end - 2) == dup && !isdigit(*(end - 2))) + if (suffix_len > 0 && (end - 2) == dup && !isdigit(*(end - 2))) return -EINVAL; - if (isalpha(*(end - 2))) { + if (suffix_len > 0 && isalpha(*(end - 2))) { if (suffix_len == 1) suffix_len++; else