From f155a74cfd009ec0c6df942f104b5aa7e7ee83a8 Mon Sep 17 00:00:00 2001 From: deraadt Date: Tue, 29 Apr 1997 21:25:20 +0000 Subject: [PATCH] possible buf oflow --- lib/libc/yp/yp_bind.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/yp/yp_bind.c b/lib/libc/yp/yp_bind.c index 9de9e0a841d..6738701d48e 100644 --- a/lib/libc/yp/yp_bind.c +++ b/lib/libc/yp/yp_bind.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: yp_bind.c,v 1.8 1997/02/05 19:19:49 deraadt Exp $"; +static char *rcsid = "$OpenBSD: yp_bind.c,v 1.9 1997/04/29 21:25:20 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -226,7 +226,8 @@ gotdata: sizeof(ysd->dom_server_addr.sin_addr.s_addr)); ysd->dom_server_port = ysd->dom_server_addr.sin_port; ysd->dom_vers = YPVERS; - (void)strcpy(ysd->dom_domain, dom); + (void)strncpy(ysd->dom_domain, dom, sizeof ysd->dom_domain-1); + ysd->dom_domain[sizeof ysd->dom_domain-1] = '\0'; } tv.tv_sec = _yplib_timeout / 2; tv.tv_usec = 0; -- 2.20.1