]> granicus.if.org Git - apache/commitdiff
Fix near-identical potential NULL pointer dereferences, as found by
authorColm MacCarthaigh <colm@apache.org>
Tue, 6 Mar 2007 02:00:18 +0000 (02:00 +0000)
committerColm MacCarthaigh <colm@apache.org>
Tue, 6 Mar 2007 02:00:18 +0000 (02:00 +0000)
Jorton and corrected in r514915

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@514954 13f79535-47bb-0310-9956-ffa450edef68

support/logresolve.c

index f0310e973b82e10999d03f2830aaa03cf6a70897..ff341423546de36ce32478a1c68b3a5430e44216 100644 (file)
@@ -259,12 +259,12 @@ int main(int argc, const char * const argv[])
         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 @@ int main(int argc, const char * const argv[])
             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;