Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1575175
 поиск   регистрация   авторизация 
 
Группа :: Система/Серверы
Пакет: apache

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: apache-1.3.27-CVE-2007-3304.patch


--- apache_1.3.27/src/main/http_main.c.cve3304
+++ apache_1.3.27/src/main/http_main.c
@@ -2771,6 +2771,17 @@
     return -1;
 }
 
+static int safe_child_kill(pid_t pid, int sig)
+{
+    if (getpgid(pid) == getpgrp()) {
+        return kill(pid, sig);
+    }
+    else {
+        errno = EINVAL;
+        return -1;
+    }
+}
+
 static void reclaim_child_processes(int terminate)
 {
 #ifndef MULTITHREAD
@@ -5008,7 +5019,7 @@
 		else if (ps->last_rtime + ss->timeout_len < now) {
 		    /* no progress, and the timeout length has been exceeded */
 		    ss->timeout_len = 0;
-		    kill(ps->pid, SIG_TIMEOUT_KILL);
+		    safe_child_kill(ps->pid, SIG_TIMEOUT_KILL);
 		}
 	    }
 #endif
@@ -5021,7 +5032,7 @@
 	 * while we were counting. Use the define SIG_IDLE_KILL to reflect
 	 * which signal should be used on the specific OS.
 	 */
-	kill(ap_scoreboard_image->parent[to_kill].pid, SIG_IDLE_KILL);
+	safe_child_kill(ap_scoreboard_image->parent[to_kill].pid, SIG_IDLE_KILL);
 	idle_spawn_rate = 1;
     }
     else if (idle_count < ap_daemons_min_free) {
 
design & coding: Vladimir Lettiev aka crux © 2004-2005