From: Agnieszka Baumann Date: Mon, 9 Mar 2020 14:13:16 +0000 (+0100) Subject: Fix improper behaviour of parse_bytes when string contains only one letter X-Git-Tag: accepted/tizen/unified/20200316.221102~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c903a06724fc838a121a21d3aeabea5493a3200;p=platform%2Fcore%2Fsystem%2Fresourced.git Fix improper behaviour of parse_bytes when string contains only one letter Change-Id: Ie50ff0a666eedf4396f9e78d3d3aff07d9802885 --- diff --git a/src/common/util.c b/src/common/util.c index c1ae720..1cdcbfb 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -140,7 +140,7 @@ int parse_bytes(const char *b, size_t *s) return 0; num_l = strspn(b, "0123456789"); - if (num_l < len-1) + if ((num_l < len-1) || num_l == 0) return -EINVAL; unit_l = strcspn(b, "BKMG");