- firedns.c:firedns_init(): unlike inet_aton(), inet_pton(), which we use now, does not
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 29 Dec 2014 13:49:30 +0000 (13:49 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Mon, 29 Dec 2014 13:49:30 +0000 (13:49 +0000)
  forgive any unknown trailing characters such as \n

git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5185 82007160-df01-0410-b94d-b575c5fd34c7

src/firedns.c

index df26056893c6d9989dc0212544e3ea3bbff0ddb6..5707cbf047f85d8d8fe46e6e7e1ede41e4db6d2a 100644 (file)
@@ -159,6 +159,7 @@ firedns_init(void)
   struct in_addr addr4;
   struct in6_addr addr6;
   char buf[1024];
+  char *p = NULL;
   const char *file;
 
   i6 = 0;
@@ -188,6 +189,9 @@ firedns_init(void)
 
     while (fgets(buf, 1024, f))
     {
+      if ((p = strchr(buf, '\n')))
+        *p = '\0';
+
       if (strncmp(buf, "nameserver", 10) == 0)
       {
         i = 10;
@@ -218,6 +222,9 @@ firedns_init(void)
 
     while (fgets(buf, 1024, f))
     {
+      if ((p = strchr(buf, '\n')))
+        *p = '\0';
+
       buf[strspn(buf, "0123456789.")] = '\0';
 
       if (i6 < FDNS_MAX)