You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2004/09/22 17:38:02 UTC

cvs commit: httpd-2.0/modules/generators mod_cgi.c

jorton      2004/09/22 08:38:02

  Modified:    modules/generators mod_cgi.c
  Log:
  * modules/generators/mod_cgi.c (cgi_handler): Fix possible segfaults
  in CGI bucket methods if invoked from a subrequest.
  
  PR: 31247
  
  Revision  Changes    Path
  1.170     +4 -1      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.169
  retrieving revision 1.170
  diff -d -w -u -r1.169 -r1.170
  --- mod_cgi.c	26 Aug 2004 20:50:55 -0000	1.169
  +++ mod_cgi.c	22 Sep 2004 15:38:02 -0000	1.170
  @@ -905,7 +905,10 @@
       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