You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2007/03/06 03:00:19 UTC

svn commit: r514954 - /httpd/httpd/trunk/support/logresolve.c

Author: colm
Date: Mon Mar  5 18:00:18 2007
New Revision: 514954

URL: http://svn.apache.org/viewvc?view=rev&rev=514954
Log:
Fix near-identical potential NULL pointer dereferences, as found by
Jorton and corrected in r514915

Modified:
    httpd/httpd/trunk/support/logresolve.c

Modified: httpd/httpd/trunk/support/logresolve.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/logresolve.c?view=diff&rev=514954&r1=514953&r2=514954
==============================================================================
--- httpd/httpd/trunk/support/logresolve.c (original)
+++ httpd/httpd/trunk/support/logresolve.c Mon Mar  5 18:00:18 2007
@@ -259,12 +259,12 @@
         status = apr_getnameinfo(&hostname, ip, 0) != APR_SUCCESS;
         if (status || hostname == NULL) {
             /* Could not perform a reverse lookup */
-            *space = ' ';
+            if (space) *space = ' ';
             apr_file_puts(line, outfile);
             noreverse++;
 
             /* Add to cache */
-            *space = '\0';
+            if (space) *space = '\0';
             apr_hash_set(cache, line, APR_HASH_KEY_STRING,
                          apr_pstrdup(pool, line));
             continue;
@@ -280,12 +280,12 @@
             if (status == APR_SUCCESS ||
                 memcmp(ipdouble->ipaddr_ptr, ip->ipaddr_ptr, ip->ipaddr_len)) {
                 /* Double-lookup failed  */
-                *space = ' ';
+                if (space) *space = ' ';
                 apr_file_puts(line, outfile);
                 doublefailed++;
 
                 /* Add to cache */
-                *space = '\0';
+                if (space) *space = '\0';
                 apr_hash_set(cache, line, APR_HASH_KEY_STRING,
                              apr_pstrdup(pool, line));
                 continue;