summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflipk <flipk@openbsd.org>1997-07-15 18:33:50 +0000
committerflipk <flipk@openbsd.org>1997-07-15 18:33:50 +0000
commitce0b12dd49d51b2d06117eae504cd1f9055212d7 (patch)
tree53b7bba8bbb2acba92eeacf19c04e2b6a1d0690f
parentXr repair (diff)
downloadwireguard-openbsd-ce0b12dd49d51b2d06117eae504cd1f9055212d7.tar.xz
wireguard-openbsd-ce0b12dd49d51b2d06117eae504cd1f9055212d7.zip
buff overflow
-rw-r--r--lib/libc/net/res_init.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index 973fdd43bee..b4cee1d3073 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_init.c,v 1.14 1997/04/13 21:30:43 provos Exp $ */
+/* $OpenBSD: res_init.c,v 1.15 1997/07/15 18:33:50 flipk Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
@@ -60,7 +60,7 @@
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_init.c,v 1.14 1997/04/13 21:30:43 provos Exp $";
+static char rcsid[] = "$OpenBSD: res_init.c,v 1.15 1997/07/15 18:33:50 flipk Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -399,7 +399,11 @@ res_init()
if (_res.defdname[0] == 0 &&
gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
(cp = strchr(buf, '.')) != NULL)
- strcpy(_res.defdname, cp + 1);
+ {
+ strncpy(_res.defdname, cp + 1,
+ sizeof(_res.defdname) - 1);
+ _res.defdname[sizeof(_res.defdname) - 1] = '\0';
+ }
/* find components of local domain that might be searched */
if (havesearch == 0) {