]> granicus.if.org Git - apache/commitdiff
fix an endless loop (well, until you run out of storage from
authorJeff Trawick <trawick@apache.org>
Thu, 30 Aug 2001 11:42:59 +0000 (11:42 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 30 Aug 2001 11:42:59 +0000 (11:42 +0000)
tiny apr_pstrdup() calls and your machine crashes) when you
have a filter chain

  ap_getword() returns an empty string, not a NULL string,
  when there are no more words

fix a segfault when you don't have a filter chain

  ap_getword() does not check for a NULL string to search

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90810 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index 1bcc30b0efbc2412f03c05ace6330264213a5117..044a11d8c0ee8f8e831b93221d62285d67390b70 100644 (file)
@@ -3358,13 +3358,17 @@ static void core_insert_filter(request_rec *r)
                                                   &core_module); 
     const char *filter, *filters = conf->output_filters;
 
-    while ((filter = ap_getword(r->pool, &filters, ';'))) {
-        ap_add_output_filter(filter, NULL, r, r->connection);
+    if (filters) {
+        while ((filter = ap_getword(r->pool, &filters, ';')) && filter[0]) {
+            ap_add_output_filter(filter, NULL, r, r->connection);
+        }
     }
 
     filters = conf->input_filters;
-    while ((filter = ap_getword(r->pool, &filters, ';'))) {
-        ap_add_input_filter(filter, NULL, r, r->connection);
+    if (filters) {
+        while ((filter = ap_getword(r->pool, &filters, ';')) && filter[0]) {
+            ap_add_input_filter(filter, NULL, r, r->connection);
+        }
     }
 }