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

index 3b09e0ba764ca9195c0b4a0d65efe7d100ba3921..429767edc27e04be0edbd1365113677ded466a95 100644 (file)
@@ -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