diff options
Diffstat (limited to 'src/lib/libc/net/res_init.c')
-rw-r--r-- | src/lib/libc/net/res_init.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index b4cee1d307..df176b7fa1 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: res_init.c,v 1.15 1997/07/15 18:33:50 flipk Exp $ */ | 1 | /* $OpenBSD: res_init.c,v 1.16 1998/03/16 05:07:01 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * ++Copyright++ 1985, 1989, 1993 | 4 | * ++Copyright++ 1985, 1989, 1993 |
@@ -60,7 +60,7 @@ | |||
60 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; | 60 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; |
61 | static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; | 61 | static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; |
62 | #else | 62 | #else |
63 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.15 1997/07/15 18:33:50 flipk Exp $"; | 63 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.16 1998/03/16 05:07:01 millert Exp $"; |
64 | #endif | 64 | #endif |
65 | #endif /* LIBC_SCCS and not lint */ | 65 | #endif /* LIBC_SCCS and not lint */ |
66 | 66 | ||
@@ -151,6 +151,7 @@ res_init() | |||
151 | int nserv = 0; /* number of nameserver records read from file */ | 151 | int nserv = 0; /* number of nameserver records read from file */ |
152 | int haveenv = 0; | 152 | int haveenv = 0; |
153 | int havesearch = 0; | 153 | int havesearch = 0; |
154 | size_t len; | ||
154 | #ifdef RESOLVSORT | 155 | #ifdef RESOLVSORT |
155 | int nsort = 0; | 156 | int nsort = 0; |
156 | char *net; | 157 | char *net; |
@@ -241,9 +242,17 @@ res_init() | |||
241 | strncpy(_res.lookups, "bf", sizeof _res.lookups); | 242 | strncpy(_res.lookups, "bf", sizeof _res.lookups); |
242 | 243 | ||
243 | /* read the config file */ | 244 | /* read the config file */ |
244 | while (fgets(buf, sizeof(buf), fp) != NULL) { | 245 | buf[0] = '\0'; |
246 | while ((cp = fgetln(fp, &len)) != NULL) { | ||
247 | /* skip lines that are too long or zero length */ | ||
248 | if (len >= sizeof(buf) || len == 0) | ||
249 | continue; | ||
250 | (void)memcpy(buf, cp, len); | ||
251 | buf[len] = '\0'; | ||
245 | /* skip comments */ | 252 | /* skip comments */ |
246 | if (*buf == ';' || *buf == '#') | 253 | if ((cp = strpbrk(buf, ";#")) != NULL) |
254 | *cp = '\0'; | ||
255 | if (buf[0] == '\0') | ||
247 | continue; | 256 | continue; |
248 | /* read default domain name */ | 257 | /* read default domain name */ |
249 | if (MATCH(buf, "domain")) { | 258 | if (MATCH(buf, "domain")) { |