Modified: trunk/launchd/src/launchd_core_logic.c (23333 => 23334)
--- 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 */