]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1234: util.c:612: xstrndup: Assertion `n' failed.
authorserassio <>
Sun, 13 Feb 2005 22:49:50 +0000 (22:49 +0000)
committerserassio <>
Sun, 13 Feb 2005 22:49:50 +0000 (22:49 +0000)
Forward port of 2.5 patch.

src/comm.cc
src/fqdncache.cc
src/ipcache.cc

index 5165ce9f43acc6a03dda68b4b3c068fdcf30927a..842d2069eaf92bb136c5459ac44c14c508c818ba 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.399 2004/12/20 16:30:35 robertc Exp $
+ * $Id: comm.cc,v 1.400 2005/02/13 15:49:50 serassio Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -1392,9 +1392,6 @@ ConnectStateData::defaults()
     S.sin_family = AF_INET;
     S.sin_addr = in_addr;
     S.sin_port = htons(port);
-
-    if (Config.onoff.log_fqdn)
-        fqdncache_gethostbyaddr(S.sin_addr, FQDN_LOOKUP_IF_MISS);
 }
 
 void
index 20d8377458831f3e24454b02417894e388d7bbc4..aa239a47b7c503dfd0c3184739293c2ee9f3f979 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fqdncache.cc,v 1.162 2004/12/20 16:30:35 robertc Exp $
+ * $Id: fqdncache.cc,v 1.163 2005/02/13 15:49:50 serassio Exp $
  *
  * DEBUG: section 35    FQDN Cache
  * AUTHOR: Harvest Derived
@@ -368,7 +368,10 @@ fqdncacheParse(fqdncache_entry *f, rfc1035_rr * answers, int nr, const char *err
         if (answers[k]._class != RFC1035_CLASS_IN)
             continue;
 
-        f->names[f->name_count++] = xstrndup(answers[k].rdata, answers[k].rdlength);
+        if (!answers[k].rdata[0])
+            continue;
+
+        f->names[f->name_count++] = xstrdup(answers[k].rdata);
 
         if (ttl == 0 || (int) answers[k].ttl < ttl)
             ttl = answers[k].ttl;
index d3a70c52bd1c08773ea818e7d3797c687c21c229..7ac28dd8bfe6186665ac322669292189325c8627 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ipcache.cc,v 1.249 2004/12/20 16:30:35 robertc Exp $
+ * $Id: ipcache.cc,v 1.250 2005/02/13 15:49:50 serassio Exp $
  *
  * DEBUG: section 14    IP Cache
  * AUTHOR: Harvest Derived
@@ -402,6 +402,11 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
         if (answers[k]._class != RFC1035_CLASS_IN)
             continue;
 
+        if (answers[k].rdlength != 4) {
+            debug(14, 1)("ipcacheParse: Invalid IP address in response to '%s'\n", name);
+            continue;
+        }
+
         na++;
     }
 
@@ -421,11 +426,12 @@ ipcacheParse(ipcache_entry *i, rfc1035_rr * answers, int nr, const char *error_m
         if (answers[k]._class != RFC1035_CLASS_IN)
             continue;
 
+        if (answers[k].rdlength != 4)
+            continue;
+
         if (ttl == 0 || (int) answers[k].ttl < ttl)
             ttl = answers[k].ttl;
 
-        assert(answers[k].rdlength == 4);
-
         xmemcpy(&i->addrs.in_addrs[j++], answers[k].rdata, 4);
 
         debug(14, 3) ("ipcacheParse: #%d %s\n",