]> granicus.if.org Git - apache/commitdiff
Merge r1328950:
authorStefan Fritsch <sf@apache.org>
Sat, 5 May 2012 08:39:31 +0000 (08:39 +0000)
committerStefan Fritsch <sf@apache.org>
Sat, 5 May 2012 08:39:31 +0000 (08:39 +0000)
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
STATUS
server/log.c

diff --git a/CHANGES b/CHANGES
index 8161661fc2fd5c696b241f1cb8e790385b89cbdf..00c98e519a5895a47d65d7923cd9408fae51f21d 100644 (file)
--- 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 f70b426ed910f505341fa878903a31a2e0b72dc3..d37c5a35c817af4896e1a16fc6d657e87c715e9a 100644 (file)
--- 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
index de560efce704854bd7c61556fa617b65fc56bee4..b33aa1fc1b98b296763ae366998fe5ce1b3e6ea5 100644 (file)
@@ -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 */