From: Jim Jagielski Date: Tue, 17 Sep 2013 18:43:30 +0000 (+0000) Subject: Merge r1523235 from trunk: X-Git-Tag: 2.4.7~203 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b5736c0511f7980052d6897b6c597b77a93d098;p=apache Merge r1523235 from trunk: mod_cache: Avoid a crash with strcmp() when the hostname is not provided. Submitted by: minfrin Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1524167 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 890fb6b2f2..5bf2455c48 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.7 + *) mod_cache: Avoid a crash with strcmp() when the hostname is not provided. + [Graham Leggett] + *) mod_headers: Add 'Header note header-name note-name' for copying a response headers value into a note. [Eric Covener] diff --git a/modules/cache/cache_storage.c b/modules/cache/cache_storage.c index af60a39b84..782dc712fc 100644 --- a/modules/cache/cache_storage.c +++ b/modules/cache/cache_storage.c @@ -713,7 +713,9 @@ int cache_invalidate(cache_request_rec *cache, request_rec *r) || APR_SUCCESS != cache_canonicalise_key(r, r->pool, location, &location_uri, &location_key) - || strcmp(r->parsed_uri.hostname, location_uri.hostname)) { + || !(r->parsed_uri.hostname && location_uri.hostname + && !strcmp(r->parsed_uri.hostname, + location_uri.hostname))) { location_key = NULL; } } @@ -726,8 +728,9 @@ int cache_invalidate(cache_request_rec *cache, request_rec *r) || APR_SUCCESS != cache_canonicalise_key(r, r->pool, content_location, &content_location_uri, &content_location_key) - || strcmp(r->parsed_uri.hostname, - content_location_uri.hostname)) { + || !(r->parsed_uri.hostname && content_location_uri.hostname + && !strcmp(r->parsed_uri.hostname, + content_location_uri.hostname))) { content_location_key = NULL; } }