1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

devnum-util: catch potential stack overruns early

This commit is contained in:
Lennart Poettering 2022-04-13 16:25:32 +02:00
parent ec61371fe6
commit 02b9047edf

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;