summaryrefslogtreecommitdiffstats
path: root/modules/generators/mod_cgi.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2004-09-22 17:38:02 +0200
committerJoe Orton <jorton@apache.org>2004-09-22 17:38:02 +0200
commitc69b0be29f4394028e57d0f97cc59f1dbee7ec04 (patch)
tree369d631cd5d9e6b1aa949a5385fade787e5d271a /modules/generators/mod_cgi.c
parent* modules/ssl/ssl_scache_shmcb.c (ssl_scahe_shmcb_init): If anonymous (diff)
downloadapache2-c69b0be29f4394028e57d0f97cc59f1dbee7ec04.tar.xz
apache2-c69b0be29f4394028e57d0f97cc59f1dbee7ec04.zip
* modules/generators/mod_cgi.c (cgi_handler): Fix possible segfaults
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
Diffstat (limited to 'modules/generators/mod_cgi.c')
-rw-r--r--modules/generators/mod_cgi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c
index 66fbe5f401..89d833a8c1 100644
--- a/modules/generators/mod_cgi.c
+++ b/modules/generators/mod_cgi.c
@@ -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