dgaudet 98/01/26 18:46:58
Modified: src/modules/standard mod_include.c Log: Fix a potential memory corruption bug -- setting r->subprocess_env = r->main->subprocess_env causes bogus behaviour as soon as any new values are added to r->subprocess_env. The new values could be allocated out of a pool which had a shorter lifespan than the pool of the table... but only if using the new table_xxxn API. As a side-effect, this fix removes the need to play with r->finfo... since modifications to the subrequest environment don't affect the parent. But that's a potential problem, about to post more details to new-httpd, this is an interim fix. Revision Changes Path 1.68 +6 -7 apachen/src/modules/standard/mod_include.c Index: mod_include.c =================================================================== RCS file: /export/home/cvs/apachen/src/modules/standard/mod_include.c,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- mod_include.c 1998/01/26 19:50:21 1.67 +++ mod_include.c 1998/01/27 02:46:56 1.68 @@ -2279,14 +2279,13 @@ } if (r->main) { - /* Kludge --- for nested includes, we want to keep the - * subprocess environment of the base document (for compatibility); - * that means torquing our own last_modified date as well so that - * the LAST_MODIFIED variable gets reset to the proper value if - * the nested document resets <!--#config timefmt--> + /* Kludge --- for nested includes, we want to keep the subprocess + * environment of the base document (for compatibility). This is only + * necessary when there has been an internal redirect somewhere along + * the way. When that happens the original environment has been + * renamed REDIRECT_foobar for each foobar. */ - r->subprocess_env = r->main->subprocess_env; - r->finfo.st_mtime = r->main->finfo.st_mtime; + r->subprocess_env = copy_table(r->pool, r->main->subprocess_env); } else { add_common_vars(r);