]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
check urlParse() return value and generate error if needed
authorwessels <>
Fri, 20 Feb 1998 03:58:52 +0000 (03:58 +0000)
committerwessels <>
Fri, 20 Feb 1998 03:58:52 +0000 (03:58 +0000)
src/urn.cc

index 8e3dc714099aeb844f07f6d97709d308542b0fc4..f13da37fa3684eec215a8886e2fecfe3effe8205 100644 (file)
@@ -93,6 +93,7 @@ urnStart(request_t * r, StoreEntry * e)
     char *host;
     UrnState *urnState;
     StoreEntry *urlres_e;
+    ErrorState *err;
     debug(52, 3) ("urnStart: '%s'\n", storeUrl(e));
     urnState = xcalloc(1, sizeof(UrnState));
     urnState->entry = e;
@@ -116,6 +117,13 @@ urnStart(request_t * r, StoreEntry * e)
     safe_free(host);
     k = storeKeyPublic(urlres, METHOD_GET);
     urlres_r = urlParse(METHOD_GET, urlres);
+    if (urlres_r == NULL) {
+       debug(52, 3) ("urnStart: Bad uri-res URL %s\n", urlres);
+       err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND);
+       err->url = xstrdup(urlres);
+       errorAppendEntry(e, err);
+       return;
+    }
     urlres_r->headers = xstrdup("Accept: text/plain\r\n\r\n");
     urlres_r->headers_sz = strlen(urlres_r->headers);
     if ((urlres_e = storeGet(k)) == NULL) {