You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1997/05/11 23:29:24 UTC

SEGV patch

This patch stops Apache-dev core dumping on me.

I think it's caused by HeaderParser modules that are called before
"the_request" is setup.  mod_browser might tickle it, my HeaderParser
modules certainly do.

--
Rob Hartill                              Internet Movie Database (Ltd)
http://us.imdb.com/tour   .. a site for sore eyes.




Index: util_script.c
===================================================================
RCS file: /imdb/cvs/apache/src/util_script.c,v
retrieving revision 1.21
diff -u -r1.21 util_script.c
--- util_script.c	1997/05/11 20:40:28	1.21
+++ util_script.c	1997/05/11 21:22:51
@@ -243,6 +243,8 @@
     char *last;
     char *first = r->the_request;
 
+    if (first == NULL) return NULL;
+
     while (*first && !isspace(*first)) ++first;
     while (isspace(*first)) ++first;
 
@@ -255,12 +257,13 @@
 void add_cgi_vars(request_rec *r)
 {
     table *e = r->subprocess_env;
+    char *orig_uri = original_uri(r);
 
     table_set (e, "GATEWAY_INTERFACE","CGI/1.1");
     table_set (e, "SERVER_PROTOCOL", r->protocol);
     table_set (e, "REQUEST_METHOD", r->method);
     table_set (e, "QUERY_STRING", r->args ? r->args : "");
-    table_set (e, "REQUEST_URI", original_uri(r));
+    table_set (e, "REQUEST_URI", orig_uri ? orig_uri : "null");
 
     /* Note that the code below special-cases scripts run from includes,
      * because it "knows" that the sub_request has been hacked to have the