]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
If urlParse() fails in mimeLoadIconFile() (e.g., because the user put
authorwessels <>
Tue, 8 Oct 2002 22:20:10 +0000 (22:20 +0000)
committerwessels <>
Tue, 8 Oct 2002 22:20:10 +0000 (22:20 +0000)
illegal characters in the visible_hostname), this patch makes Squid
emit a fatal error message, rather than suffer a NULL pointer
dereference.

src/mime.cc

index c7a41c10c4fd80389a2c61b29defe8bc3aa8eef0..b2f06d31300d6f24d50791f599838a5a10acea54 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mime.cc,v 1.103 2002/09/01 15:16:35 hno Exp $
+ * $Id: mime.cc,v 1.104 2002/10/08 16:20:10 wessels Exp $
  *
  * DEBUG: section 25    MIME Parsing
  * AUTHOR: Harvest Derived
@@ -402,6 +402,7 @@ mimeLoadIconFile(const char *icon)
     const char *type = mimeGetContentType(icon);
     HttpReply *reply;
     http_version_t version;
+    request_t *r;
     if (type == NULL)
        fatal("Unknown icon format while reading mime.conf\n");
     buf = internalLocalUri("/squid-internal-static/icons/", icon);
@@ -429,7 +430,10 @@ mimeLoadIconFile(const char *icon)
     EBIT_SET(e->flags, ENTRY_SPECIAL);
     storeSetPublicKey(e);
     storeBuffer(e);
-    e->mem_obj->request = requestLink(urlParse(METHOD_GET, url));
+    r = urlParse(METHOD_GET, url);
+    if (NULL == r)
+       fatal("mimeLoadIcon: cannot parse internal URL");
+    e->mem_obj->request = requestLink(r);
     httpReplyReset(reply = e->mem_obj->reply);
     httpBuildVersion(&version, 1, 0);
     httpReplySetHeaders(reply, version, HTTP_OK, NULL,