devnum-util: catch potential stack overruns early

This commit is contained in:
Lennart Poettering
2022-04-13 16:26:31 +02:00
parent ec61371fe6
commit 02b9047edf
+2
View File
@@ -18,6 +18,8 @@ int parse_devnum(const char *s, dev_t *ret) {
n = strspn(s, DIGITS);
if (n == 0)
return -EINVAL;
if (n > DECIMAL_STR_MAX(dev_t))
return -EINVAL;
if (s[n] != ':')
return -EINVAL;