From 232ffd59b4d68c11d2c2bb86d8fec1134b9a5a95 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 29 Dec 2014 13:49:50 +0000 Subject: [PATCH] - firedns.c:firedns_init(): unlike inet_aton(), inet_pton(), which we use now, does not forgive any unknown trailing characters such as \n git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.0.x@5186 82007160-df01-0410-b94d-b575c5fd34c7 --- src/firedns.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/firedns.c b/src/firedns.c index df26056..5707cbf 100644 --- a/src/firedns.c +++ b/src/firedns.c @@ -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) -- 2.30.2