]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: check suffix length 2061/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Jan 2018 11:21:09 +0000 (12:21 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 17 Jan 2018 11:21:09 +0000 (12:21 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c

index cbf16cb627808b195972d47b22daf1689716325f..a20e4b715ebbf71a5c7cfce67bf6ff1489dda039 100644 (file)
@@ -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