httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [patch] segfault in ap_internal_redirect
Date Mon, 02 Jun 2003 10:29:51 GMT
got this segfault:

#0  ap_process_request_internal (r=0x0) at request.c:145
#1  0x0809aa2e in ap_internal_redirect (
     new_uri=0x817a958 "/error/HTTP_INTERNAL_SERVER_ERROR.html.var",
     r=0x846d700) at http_request.c:483
#2  0x0809a539 in ap_process_request (r=0x846d700) at http_request.c:301
#3  0x080963f9 in ap_process_http_connection (c=0x84677c0) at http_core.c:293
#4  0x080cb25b in ap_run_process_connection (c=0x84677c0) at connection.c:85
#5  0x080c0274 in child_main (child_num_arg=0) at prefork.c:696
#6  0x080c038f in make_child (s=0x811af18, slot=9) at prefork.c:790
#7  0x080c047e in startup_children (number_to_start=1) at prefork.c:808
#8  0x080c0bbb in ap_mpm_run (_pconf=0x8115b78, plog=0x815dc98, s=0x8113b70)
     at prefork.c:1024
#9  0x080c5e1a in main (argc=3, argv=0xbffff484) at main.c:660

internal_internal_redirect() may return NULL, but this is not tested, causing 
segfault in these situations. The following patch fixes that. Notice that when 
NULL is returned ap_die has been already called, so no special action is 
required on ap_internal_redirect's part.

Index: modules/http/http_request.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.152.2.4
diff -u -r1.152.2.4 http_request.c
--- modules/http/http_request.c 19 May 2003 15:24:05 -0000      1.152.2.4
+++ modules/http/http_request.c 2 Jun 2003 10:27:13 -0000
@@ -480,16 +480,19 @@
  AP_DECLARE(void) ap_internal_redirect(const char *new_uri, request_rec *r)
  {
      request_rec *new = internal_internal_redirect(new_uri, r);
-    int access_status = ap_process_request_internal(new);
-    if (access_status == OK) {
-        if ((access_status = ap_invoke_handler(new)) != 0) {
+    if (new) {
+        int access_status = ap_process_request_internal(new);
+
+        if (access_status == OK) {
+            if ((access_status = ap_invoke_handler(new)) != 0) {
+                ap_die(access_status, new);
+                return;
+            }
+            ap_finalize_request_protocol(new);
+        }
+        else {
              ap_die(access_status, new);
-            return;
          }
-        ap_finalize_request_protocol(new);
-    }
-    else {
-        ap_die(access_status, new);
      }
  }



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message