From 734189646adb9dedf3b15af0ace530e846d3b034 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 15 Feb 1997 23:44:31 +0000 Subject: [PATCH] buf oflow, danny@freebsd.org --- lib/libc/db/hash/ndbm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libc/db/hash/ndbm.c b/lib/libc/db/hash/ndbm.c index 4ac67b56df9..3d68ba0fec4 100644 --- a/lib/libc/db/hash/ndbm.c +++ b/lib/libc/db/hash/ndbm.c @@ -35,7 +35,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: ndbm.c,v 1.3 1996/08/19 08:20:42 tholo Exp $"; +static char rcsid[] = "$OpenBSD: ndbm.c,v 1.4 1997/02/15 23:44:31 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -64,6 +64,10 @@ dbm_open(file, flags, mode) HASHINFO info; char path[MAXPATHLEN]; + if (strlen(file) + strlen(DBM_SUFFIX) > sizeof(path)-1) { + errno = ENAMETOOLONG; + return (NULL); + } info.bsize = 4096; info.ffactor = 40; info.nelem = 1; -- 2.20.1