Skip to content

Commit

Permalink
utils: check suffix length
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jan 17, 2018
1 parent 99eafdd commit c2229b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lxc/utils.c
Expand Up @@ -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
Expand Down

0 comments on commit c2229b2

Please sign in to comment.