diff options
author | deraadt <> | 1996-08-27 03:32:54 +0000 |
---|---|---|
committer | deraadt <> | 1996-08-27 03:32:54 +0000 |
commit | 1ff36ec37b7d30e9c6351562803a162b37eb1d05 (patch) | |
tree | 777b01f70103239826eb4559e40abbb58efadee0 /src/lib/libc/net/res_init.c | |
parent | 411b2edc62326f2d748e090f902cfed0a2e2c876 (diff) | |
download | openbsd-1ff36ec37b7d30e9c6351562803a162b37eb1d05.tar.gz openbsd-1ff36ec37b7d30e9c6351562803a162b37eb1d05.tar.bz2 openbsd-1ff36ec37b7d30e9c6351562803a162b37eb1d05.zip |
use strncpy correctly
Diffstat (limited to 'src/lib/libc/net/res_init.c')
-rw-r--r-- | src/lib/libc/net/res_init.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index c925236869..cb60d4c0df 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
@@ -52,7 +52,7 @@ | |||
52 | */ | 52 | */ |
53 | 53 | ||
54 | #if defined(LIBC_SCCS) && !defined(lint) | 54 | #if defined(LIBC_SCCS) && !defined(lint) |
55 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.5 1996/08/25 10:11:02 deraadt Exp $"; | 55 | static char rcsid[] = "$OpenBSD: res_init.c,v 1.6 1996/08/27 03:32:53 deraadt Exp $"; |
56 | #endif /* LIBC_SCCS and not lint */ | 56 | #endif /* LIBC_SCCS and not lint */ |
57 | 57 | ||
58 | #include <sys/param.h> | 58 | #include <sys/param.h> |
@@ -131,6 +131,7 @@ res_init() | |||
131 | /* Allow user to override the local domain definition */ | 131 | /* Allow user to override the local domain definition */ |
132 | if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) { | 132 | if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) { |
133 | (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); | 133 | (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); |
134 | _res.defdname[sizeof(_res.defdname) - 1] = '\0'; | ||
134 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) | 135 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) |
135 | *cp = '\0'; | 136 | *cp = '\0'; |
136 | haveenv++; | 137 | haveenv++; |
@@ -183,6 +184,7 @@ res_init() | |||
183 | continue; | 184 | continue; |
184 | (void)strncpy(_res.defdname, cp, | 185 | (void)strncpy(_res.defdname, cp, |
185 | sizeof(_res.defdname) - 1); | 186 | sizeof(_res.defdname) - 1); |
187 | _res.defdname[sizeof(_res.defdname) - 1] = '\0'; | ||
186 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) | 188 | if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) |
187 | *cp = '\0'; | 189 | *cp = '\0'; |
188 | havesearch = 0; | 190 | havesearch = 0; |
@@ -226,6 +228,7 @@ res_init() | |||
226 | continue; | 228 | continue; |
227 | (void)strncpy(_res.defdname, cp, | 229 | (void)strncpy(_res.defdname, cp, |
228 | sizeof(_res.defdname) - 1); | 230 | sizeof(_res.defdname) - 1); |
231 | _res.defdname[sizeof(_res.defdname) - 1] = '\0'; | ||
229 | if ((cp = strchr(_res.defdname, '\n')) != NULL) | 232 | if ((cp = strchr(_res.defdname, '\n')) != NULL) |
230 | *cp = '\0'; | 233 | *cp = '\0'; |
231 | /* | 234 | /* |