httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sterling <sterl...@covalent.net>
Subject [PATCH] mod_mime.c core dumps with no AddType
Date Wed, 22 Aug 2001 19:56:41 GMT
It appears that the extension_mappings hash is initialized to null, then
only instanciated if there is an AddType call in your conf file.  Hence in
the type_checker phase it tries to perform a lookup on a null hash.

this patch should fix the crash, but IMHO by that point the
extension_mappings hash should just be empty, not null (i.e. it should be
initialized to apr_hash_make) --


sterling


Index: modules/http/mod_mime.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/http/mod_mime.c,v
retrieving revision 1.55
diff -u -r1.55 mod_mime.c
--- modules/http/mod_mime.c	2001/08/19 05:48:18	1.55
+++ modules/http/mod_mime.c	2001/08/22 19:45:04
@@ -812,7 +812,7 @@
     /* Parse filename extensions which can be in any order
      */
     while (*fn && (ext = ap_getword(r->pool, &fn, '.'))) {
-        extension_info *exinfo;
+        extension_info *exinfo = NULL;
         int found;

         if (*ext == '\0')  /* ignore empty extensions "bad..html" */
@@ -827,9 +827,10 @@
         ap_str_tolower(ext);
 #endif

-        exinfo = (extension_info*) apr_hash_get(conf->extension_mappings,
-                                                ext, APR_HASH_KEY_STRING);
-
+        if( conf->extension_mappings != NULL ) {
+            exinfo = (extension_info*) apr_hash_get(conf->extension_mappings,
+                                                    ext, APR_HASH_KEY_STRING);
+        }
         if (exinfo == NULL) {
             if ((type = apr_hash_get(mime_type_extensions, ext,
                                      APR_HASH_KEY_STRING)) != NULL) {


Mime
View raw message