From: Christian Brauner Date: Wed, 17 Jan 2018 11:21:09 +0000 (+0100) Subject: utils: check suffix length X-Git-Tag: lxc-2.0.10~408 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e4a6841757f5c5e9af93f740e8f50c81619a61e8;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 3b09e0ba7..429767edc 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -2341,10 +2341,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