httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1328950 - in /httpd/httpd/trunk: CHANGES server/log.c
Date Sun, 22 Apr 2012 19:41:59 GMT
Author: sf
Date: Sun Apr 22 19:41:59 2012
New Revision: 1328950

URL: http://svn.apache.org/viewvc?rev=1328950&view=rev
Log:
Fix segfault in logging if r->useragent_addr or c->client_addr is unset

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/log.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1328950&r1=1328949&r2=1328950&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sun Apr 22 19:41:59 2012
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) core: Fix segfault in logging if r->useragent_addr or c->client_addr is
+     unset. [Stefan Fritsch]
+
   *) cross-compile: allow to provide CC_FOR_BUILD so that gen_test_char will
      be compiled by the build compiler instead of the host compiler.
      Also set CC_FOR_BUILD to 'cc' when cross-compilation is detected.

Modified: httpd/httpd/trunk/server/log.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/log.c?rev=1328950&r1=1328949&r2=1328950&view=diff
==============================================================================
--- httpd/httpd/trunk/server/log.c (original)
+++ httpd/httpd/trunk/server/log.c Sun Apr 22 19:41:59 2012
@@ -563,10 +563,10 @@ static int log_remote_address(const ap_e
 {
     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_
     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 */



Mime
View raw message