summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/res_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/res_init.c')
-rw-r--r--src/lib/libc/net/res_init.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c
index c44539604a..5134323f4e 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.21 2001/06/11 10:06:00 itojun Exp $ */ 1/* $OpenBSD: res_init.c,v 1.22 2001/06/27 00:58:55 lebel Exp $ */
2 2
3/* 3/*
4 * ++Copyright++ 1985, 1989, 1993 4 * ++Copyright++ 1985, 1989, 1993
@@ -64,7 +64,7 @@
64static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; 64static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
65static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $"; 65static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
66#else 66#else
67static char rcsid[] = "$OpenBSD: res_init.c,v 1.21 2001/06/11 10:06:00 itojun Exp $"; 67static char rcsid[] = "$OpenBSD: res_init.c,v 1.22 2001/06/27 00:58:55 lebel Exp $";
68#endif 68#endif
69#endif /* LIBC_SCCS and not lint */ 69#endif /* LIBC_SCCS and not lint */
70 70
@@ -215,8 +215,7 @@ res_init()
215 215
216 /* Allow user to override the local domain definition */ 216 /* Allow user to override the local domain definition */
217 if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) { 217 if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) {
218 (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); 218 strlcpy(_res.defdname, cp, sizeof(_res.defdname));
219 _res.defdname[sizeof(_res.defdname) - 1] = '\0';
220 haveenv++; 219 haveenv++;
221 220
222 /* 221 /*
@@ -278,8 +277,7 @@ res_init()
278 cp++; 277 cp++;
279 if ((*cp == '\0') || (*cp == '\n')) 278 if ((*cp == '\0') || (*cp == '\n'))
280 continue; 279 continue;
281 strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); 280 strlcpy(_res.defdname, cp, sizeof(_res.defdname));
282 _res.defdname[sizeof(_res.defdname) - 1] = '\0';
283 if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) 281 if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL)
284 *cp = '\0'; 282 *cp = '\0';
285 havesearch = 0; 283 havesearch = 0;
@@ -321,8 +319,7 @@ res_init()
321 cp++; 319 cp++;
322 if ((*cp == '\0') || (*cp == '\n')) 320 if ((*cp == '\0') || (*cp == '\n'))
323 continue; 321 continue;
324 strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); 322 strlcpy(_res.defdname, cp, sizeof(_res.defdname));
325 _res.defdname[sizeof(_res.defdname) - 1] = '\0';
326 if ((cp = strchr(_res.defdname, '\n')) != NULL) 323 if ((cp = strchr(_res.defdname, '\n')) != NULL)
327 *cp = '\0'; 324 *cp = '\0';
328 /* 325 /*
@@ -520,9 +517,8 @@ res_init()
520 gethostname(buf, sizeof(_res.defdname) - 1) == 0 && 517 gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
521 (cp = strchr(buf, '.')) != NULL) 518 (cp = strchr(buf, '.')) != NULL)
522 { 519 {
523 strncpy(_res.defdname, cp + 1, 520 strlcpy(_res.defdname, cp + 1,
524 sizeof(_res.defdname) - 1); 521 sizeof(_res.defdname));
525 _res.defdname[sizeof(_res.defdname) - 1] = '\0';
526 } 522 }
527 523
528 /* find components of local domain that might be searched */ 524 /* find components of local domain that might be searched */