changeset 36:95607fbef608

no message
author carl
date Sun, 30 May 2004 18:38:36 -0700
parents d718dca81bc9
children ccf2c2651c1d
files src/dnsbl.cpp
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dnsbl.cpp	Sun May 30 17:47:13 2004 -0700
+++ b/src/dnsbl.cpp	Sun May 30 18:38:36 2004 -0700
@@ -442,7 +442,8 @@
                                 *(n++) = '.';
                             }
                         }
-                        *(--n) = '\0';              // remove trailing .
+                        if (n-nam) n--;             // remove trailing .
+                        *n = '\0';                  // null terminate it
                         register_string(ns, nam);   // ns host to lookup later
                     }
                 }
@@ -600,7 +601,7 @@
             discard(nameservers);
             return reject_host;
         }
-        host = register_string(priv.memory->hosts, (*i).first); // put a copy into priv.memory->hosts, and return that reference
+        host = (*i).first;  // a transient reference that needs to be replaced before we return it
         ip   = (*i).second;
         if (!ip) ip = protected_dns_interface(host, false, NULL);
         if (debug_syslog) {
@@ -619,6 +620,7 @@
         if (ip) {
             status st = check_single(ip, dc.content_suffix);
             if (st == reject) {
+                host = register_string(priv.memory->hosts, host);   // put a copy into priv.memory->hosts, and return that reference
                 discard(nameservers);
                 return st;
             }