]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: tighten range check before casting to pid_t 29231/head
authorLennart Poettering <lennart@poettering.net>
Tue, 19 Sep 2023 14:04:34 +0000 (16:04 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 19 Sep 2023 20:43:06 +0000 (22:43 +0200)
src/basic/cgroup-util.c

index 2d13e48366b786a097bf90c9e5345749a6883ba2..92caccfcd476e9c282097ae417e1cc0aa2a7c1ba 100644 (file)
@@ -83,6 +83,8 @@ int cg_read_pid(FILE *f, pid_t *ret) {
 
         if (ul <= 0)
                 return -EIO;
+        if (ul > PID_T_MAX)
+                return -EIO;
 
         *ret = (pid_t) ul;
         return 1;