From: Lennart Poettering Date: Wed, 13 Apr 2022 14:25:32 +0000 (+0200) Subject: devnum-util: catch potential stack overruns early X-Git-Tag: v251-rc2~130^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F23070%2Fhead;p=thirdparty%2Fsystemd.git devnum-util: catch potential stack overruns early --- diff --git a/src/basic/devnum-util.c b/src/basic/devnum-util.c index e0ecf548839..70c07315c59 100644 --- a/src/basic/devnum-util.c +++ b/src/basic/devnum-util.c @@ -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;