ERR_DNS_FAIL coredump patch

From: Duane Wessels <wessels@dont-contact.us>
Date: Thu, 19 Jun 97 09:27:12 -0700

Index: src/dnsserver.c
===================================================================
RCS file: /surf1/CVS/squid/src/dnsserver.c,v
retrieving revision 1.32.2.3
diff -w -u -r1.32.2.3 dnsserver.c
--- dnsserver.c 1997/05/31 23:15:59 1.32.2.3
+++ dnsserver.c 1997/06/19 16:26:34
@@ -247,11 +247,13 @@
         return "Unknown DNS problem";
 }
 
+#define REQ_SZ 512
+
 int
 main(int argc, char *argv[])
 {
- char request[256];
- char msg[256];
+ char request[512];
+ char msg[1024];
     const struct hostent *result = NULL;
     FILE *logfile = NULL;
     long start;
@@ -304,12 +306,14 @@
     for (;;) {
         int retry_count = 0;
         struct in_addr ip;
- memset(request, '\0', 256);
+ memset(request, '\0', REQ_SZ);
 
         /* read from ipcache */
- if (fgets(request, 255, stdin) == NULL)
+ if (fgets(request, REQ_SZ, stdin) == NULL)
             exit(1);
- if ((t = strrchr(request, '\n')) != NULL)
+ t = strrchr(request, '\n');
+ if (t == NULL) /* Ignore if no newline */
+ continue;
             *t = '\0'; /* strip NL */
         if ((t = strrchr(request, '\r')) != NULL)
             *t = '\0'; /* strip CR */
Index: src/ipcache.c
===================================================================
RCS file: /surf1/CVS/squid/src/ipcache.c,v
retrieving revision 1.106.2.18
diff -w -u -r1.106.2.18 ipcache.c
--- ipcache.c 1997/06/05 05:46:25 1.106.2.18
+++ ipcache.c 1997/06/19 16:26:34
@@ -581,6 +581,10 @@
     dnsData->offset += len;
     dnsData->ip_inbuf[dnsData->offset] = '\0';
     i = dnsData->data;
+ if (i == NULL) {
+ debug_trap("NULL ipcache_entry");
+ return;
+ }
     if (i->status != IP_DISPATCHED)
         fatal_dump("ipcache_dnsHandleRead: bad status");
     if (strstr(dnsData->ip_inbuf, "$end\n")) {
Received on Thu Jun 19 1997 - 09:38:21 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:35:33 MST