diff options
author | Stefan Fritsch <sf@apache.org> | 2011-12-18 18:38:24 +0100 |
---|---|---|
committer | Stefan Fritsch <sf@apache.org> | 2011-12-18 18:38:24 +0100 |
commit | 42c9e0b3936fbc1daa0e935aa0f95d32a0c42985 (patch) | |
tree | 911ac09eb0de2de793f5ecf3e64902e8bacd82b1 | |
parent | remove some dead code (diff) | |
download | apache2-42c9e0b3936fbc1daa0e935aa0f95d32a0c42985.tar.xz apache2-42c9e0b3936fbc1daa0e935aa0f95d32a0c42985.zip |
Avoid segfault if url->hostname is NULL and filter->hostname is "*" or ".".
Found by clang.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1220467 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | modules/cache/cache_util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/cache/cache_util.c b/modules/cache/cache_util.c index 4b19d1ed4b..bad438aca2 100644 --- a/modules/cache/cache_util.c +++ b/modules/cache/cache_util.c @@ -72,8 +72,10 @@ static int uri_meets_conditions(const apr_uri_t *filter, const int pathlen, const size_t fhostlen = strlen(filter->hostname); const size_t uhostlen = url->hostname ? strlen(url->hostname) : 0; - if (fhostlen > uhostlen || strcasecmp(filter->hostname, - url->hostname + uhostlen - fhostlen)) { + if (fhostlen > uhostlen + || (url->hostname + && strcasecmp(filter->hostname, + url->hostname + uhostlen - fhostlen))) { return 0; } } @@ -81,8 +83,10 @@ static int uri_meets_conditions(const apr_uri_t *filter, const int pathlen, const size_t fhostlen = strlen(filter->hostname + 1); const size_t uhostlen = url->hostname ? strlen(url->hostname) : 0; - if (fhostlen > uhostlen || strcasecmp(filter->hostname + 1, - url->hostname + uhostlen - fhostlen)) { + if (fhostlen > uhostlen + || (url->hostname + && strcasecmp(filter->hostname + 1, + url->hostname + uhostlen - fhostlen))) { return 0; } } |