From d66cc501dde7b549aaefa169e8cd36bfae4a713c Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Sat, 5 May 2012 08:39:31 +0000 Subject: [PATCH] Merge r1328950: Fix segfault in logging if r->useragent_addr or c->client_addr is unset. Reviewed by: sf, jorton, trawick git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1334344 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 7 ------- server/log.c | 10 ++++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CHANGES b/CHANGES index 8161661fc2..00c98e519a 100644 --- a/CHANGES +++ b/CHANGES @@ -3,6 +3,9 @@ Changes with Apache 2.4.3 + *) core: Fix segfault in logging if r->useragent_addr or c->client_addr is + unset. [Stefan Fritsch] + *) log_server_status: Bring Perl style forward to the present, use standard modules, update for new format of server-status output. PR 45424. [Richard Bowen, Dave Brondsema, and others] diff --git a/STATUS b/STATUS index f70b426ed9..d37c5a35c8 100644 --- a/STATUS +++ b/STATUS @@ -88,13 +88,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * core: Fix segfault in logging if r->useragent_addr or c->client_addr is - unset. (This can only happen with buggy modules but it happened to me - while playing with mod_perl). - trunk patch: http://svn.apache.org/viewvc?rev=1328950&view=rev - 2.4 patch: Trunk patch works - +1: sf, jorton, trawick - * mod_ssl: Send speaking-http-on-https-port error response with http 1.0, not 0.9. Remove potentially wrong link. PR 50823 trunk patches: http://svn.apache.org/viewvc?rev=1328325&view=rev diff --git a/server/log.c b/server/log.c index de560efce7..b33aa1fc1b 100644 --- a/server/log.c +++ b/server/log.c @@ -563,10 +563,10 @@ static int log_remote_address(const ap_errorlog_info *info, const char *arg, { if (info->r && !(arg && *arg == 'c')) return apr_snprintf(buf, buflen, "%s:%d", info->r->useragent_ip, - info->r->useragent_addr->port); + info->r->useragent_addr ? info->r->useragent_addr->port : 0); else if (info->c) return apr_snprintf(buf, buflen, "%s:%d", info->c->client_ip, - info->c->client_addr->port); + info->c->client_addr ? info->c->client_addr->port : 0); else return 0; } @@ -968,12 +968,14 @@ static int do_errorlog_default(const ap_errorlog_info *info, char *buf, if (info->r) { len += apr_snprintf(buf + len, buflen - len, info->r->connection->sbh ? "[client %s:%d] " : "[remote %s:%d] ", - info->r->useragent_ip, info->r->useragent_addr->port); + info->r->useragent_ip, + info->r->useragent_addr ? info->r->useragent_addr->port : 0); } else if (info->c) { len += apr_snprintf(buf + len, buflen - len, info->c->sbh ? "[client %s:%d] " : "[remote %s:%d] ", - info->c->client_ip, info->c->client_addr->port); + info->c->client_ip, + info->c->client_addr ? info->c->client_addr->port : 0); } /* the actual error message */ -- 2.40.0