From: Stefan Fritsch Date: Wed, 28 Dec 2011 23:17:32 +0000 (+0000) Subject: Merge r1225380: X-Git-Tag: 2.4.0~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=364d2933bcd014673d10623edfb6bb53379ec0e3;p=apache Merge r1225380: Fix segfault when trying to log a nameless valueless cookie PR: 52256 Submitted by: Rainer Canavan git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1225385 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index beedc7ace8..9095df4227 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.0 + *) mod_log_config: Fix segfault when trying to log a nameless, valueless + cookie. PR 52256. [Rainer Canavan ] + *) mod_ssl: when compiled against OpenSSL 1.0.1 or later, allow explicit control of TLSv1.1 and TLSv1.2 through the SSLProtocol directive. [Kaspar Brand] diff --git a/modules/loggers/mod_log_config.c b/modules/loggers/mod_log_config.c index 0f35e6b965..caea1f388b 100644 --- a/modules/loggers/mod_log_config.c +++ b/modules/loggers/mod_log_config.c @@ -541,19 +541,21 @@ static const char *log_cookie(request_rec *r, char *a) while ((cookie = apr_strtok(cookies, ";", &last1))) { char *name = apr_strtok(cookie, "=", &last2); - char *value; - apr_collapse_spaces(name, name); - - if (!strcasecmp(name, a) && (value = apr_strtok(NULL, "=", &last2))) { - char *last; - value += strspn(value, " \t"); /* Move past leading WS */ - last = value + strlen(value) - 1; - while (last >= value && apr_isspace(*last)) { - *last = '\0'; - --last; + if (name) { + char *value; + apr_collapse_spaces(name, name); + + if (!strcasecmp(name, a) && (value = apr_strtok(NULL, "=", &last2))) { + char *last; + value += strspn(value, " \t"); /* Move past leading WS */ + last = value + strlen(value) - 1; + while (last >= value && apr_isspace(*last)) { + *last = '\0'; + --last; + } + + return ap_escape_logitem(r->pool, value); } - - return ap_escape_logitem(r->pool, value); } cookies = NULL; }