commit 3b1df1f2f24b1f93a501a16f78c2b73f7981056c Author: Amos Jeffries Date: 2017-07-08 22:04:48 +1200 Validate mime icon URL before allocating store entries diff --git a/src/mime.cc b/src/mime.cc index ef610e6..a159dea 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -399,6 +399,10 @@ MimeIcon::created(StoreEntry *newEntry) status = Http::scNoContent; } + HttpRequest *r = HttpRequest::CreateFromUrl(url_); + if (!r) + fatalf("mimeLoadIcon: cannot parse internal URL: %s", url_); + // fill newEntry with a canned 2xx response object RequestFlags flags; flags.cachable = true; @@ -407,10 +411,6 @@ MimeIcon::created(StoreEntry *newEntry) EBIT_SET(e->flags, ENTRY_SPECIAL); e->setPublicKey(); e->buffer(); - HttpRequest *r = HttpRequest::CreateFromUrl(url_); - - if (NULL == r) - fatalf("mimeLoadIcon: cannot parse internal URL: %s", url_); e->mem_obj->request = r; HTTPMSGLOCK(e->mem_obj->request);