From b56305855b048ed0bf6503aa0a7765cf3d5b04ee Mon Sep 17 00:00:00 2001 From: flipk Date: Tue, 15 Jul 1997 18:33:51 +0000 Subject: buff overflow --- lib/libc/net/res_init.c | 10 +++++++--- 1 file 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) { -- cgit v1.2.3