From 96a7422a24d8d3400eea0ab59a54aad3d890b52c Mon Sep 17 00:00:00 2001 From: wessels <> Date: Tue, 8 Oct 2002 22:20:10 +0000 Subject: [PATCH] If urlParse() fails in mimeLoadIconFile() (e.g., because the user put 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mime.cc b/src/mime.cc index c7a41c10c4..b2f06d3130 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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, -- 2.47.2