Revision: 23334 http://trac.macosforge.org/projects/launchd/changeset/23334 Author: zarzycki@apple.com Date: 2007-08-14 09:30:48 -0700 (Tue, 14 Aug 2007) Log Message: ----------- More sanity checks. Modified Paths: -------------- trunk/launchd/src/launchd_core_logic.c Modified: trunk/launchd/src/launchd_core_logic.c =================================================================== --- trunk/launchd/src/launchd_core_logic.c 2007-08-14 16:06:10 UTC (rev 23333) +++ trunk/launchd/src/launchd_core_logic.c 2007-08-14 16:30:48 UTC (rev 23334) @@ -985,11 +985,20 @@ if (!jobmgr_assumes(jm, anonpid != 0)) { return NULL; } + + if (!jobmgr_assumes(jm, anonpid < 100000)) { + /* The kernel current defines PID_MAX to be 99999, but that define isn't exported */ + return NULL; + } if (!jobmgr_assumes(jm, sysctl(mib, 4, &kp, &len, NULL, 0) != -1)) { return NULL; } + if (!jobmgr_assumes(jm, kp.kp_proc.p_comm[0] != '\0')) { + return NULL; + } + if (kp.kp_proc.p_stat == SZOMB) { jobmgr_log(jm, LOG_DEBUG, "Tried to create an anonymous job for zombie PID: %u", anonpid); zombie = "zombie"; @@ -1001,6 +1010,7 @@ break; case 1: if (getpid() != 1) { + /* we cannot possibly find a parent job_t that is useful in this function */ break; } /* fall through */
participants (1)
-
source_changes@macosforge.org