]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
devnum-util: catch potential stack overruns early 23070/head
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Apr 2022 14:25:32 +0000 (16:25 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Apr 2022 14:26:31 +0000 (16:26 +0200)
src/basic/devnum-util.c

index e0ecf548839d4a5c3e3055225d4ba1f040f865ef..70c07315c599f6743a11b3d76d171da7b2c36cc2 100644 (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;