]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* modules/generators/mod_cgi.c (cgi_handler): Fix possible segfaults
authorJoe Orton <jorton@apache.org>
Wed, 22 Sep 2004 15:38:02 +0000 (15:38 +0000)
committerJoe Orton <jorton@apache.org>
Wed, 22 Sep 2004 15:38:02 +0000 (15:38 +0000)
in CGI bucket methods if invoked from a subrequest.

PR: 31247

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105250 13f79535-47bb-0310-9956-ffa450edef68

modules/generators/mod_cgi.c

index 66fbe5f40145005d7fe88926068cac7e73450666..89d833a8c159179f389ddc0b0611ccc3acfc1791 100644 (file)
@@ -905,7 +905,10 @@ static int cgi_handler(request_rec *r)
     apr_file_pipe_timeout_set(script_in, 0);
     apr_file_pipe_timeout_set(script_err, 0);
     
-    b = cgi_bucket_create(r, script_in, script_err, c->bucket_alloc);
+    /* if r is a subrequest, ensure that the bucket only references
+     * r->main, since it may last longer than the subreq. */
+    b = cgi_bucket_create(r->main ? r->main : r, script_in, script_err,
+                          c->bucket_alloc);
 #else
     b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
 #endif