From: Joe Orton Date: Wed, 22 Sep 2004 15:38:02 +0000 (+0000) Subject: * modules/generators/mod_cgi.c (cgi_handler): Fix possible segfaults X-Git-Tag: 2.1.1~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c69b0be29f4394028e57d0f97cc59f1dbee7ec04;p=thirdparty%2Fapache%2Fhttpd.git * 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 --- diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 66fbe5f4014..89d833a8c15 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