From c2229b24f93797b459aba479a80fc4c244f92302 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 17 Jan 2018 12:21:09 +0100 Subject: [PATCH] utils: check suffix length Signed-off-by: Christian Brauner --- src/lxc/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.47.2