[eggheads-patches] PATCH1.4: dnsfix.patch

Florian Sander gquann at gmx.de
Wed Oct 20 11:52:32 CST 1999


There's a little bug in block_dns_hostbyip. It makes the bot crash if
a bot with a broken dns-lookup attempts to link to it. This patch
fixes it.
-------------- next part --------------
diff -urN eggdrop1.4/src/dns.c patched1.4/src/dns.c
--- eggdrop1.4/src/dns.c	Mon Oct 11 09:59:57 1999
+++ patched1.4/src/dns.c	Mon Oct 18 12:51:16 1999
@@ -145,8 +145,11 @@
     alarm(resolve_timeout);
     hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
     alarm(0);
-    strncpy(s, hp->h_name, UHOSTLEN - 1);
-    s[UHOSTLEN - 1] = 0;
+    if (hp) {
+      strncpy(s, hp->h_name, UHOSTLEN - 1);
+      s[UHOSTLEN - 1] = 0;
+    } else
+      strcpy(s, iptostr(addr));
   } else {
     hp = NULL;
     strcpy(s, iptostr(addr));


More information about the Patches mailing list