diff options
author | flipk <flipk@cvs.openbsd.org> | 1997-07-15 18:33:51 +0000 |
---|---|---|
committer | flipk <flipk@cvs.openbsd.org> | 1997-07-15 18:33:51 +0000 |
commit | b56305855b048ed0bf6503aa0a7765cf3d5b04ee (patch) | |
tree | 9c53f295aa4f2e625ed81b151cecec90bfba811f /lib/libc/net/res_init.c | |
parent | 7f43023a7afc217477b6e07ebb3d046b0779dc0c (diff) |
buff overflow
Diffstat (limited to 'lib/libc/net/res_init.c')
-rw-r--r-- | lib/libc/net/res_init.c | 10 |
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) { |