aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel O'Callaghan <danny@FreeBSD.org>1997-02-15 07:10:26 +0000
committerDaniel O'Callaghan <danny@FreeBSD.org>1997-02-15 07:10:26 +0000
commitd53ec6c0d06d20d040e0216a87f38a6105d72fc6 (patch)
treee09a6284f76f854bc764c92339516107a34bd118 /lib
parent21bef063735abebaecc4a869befdc966d051537c (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/db/hash/ndbm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/db/hash/ndbm.c b/lib/libc/db/hash/ndbm.c
index be6ff72859a9..2e8165d2b8b7 100644
--- a/lib/libc/db/hash/ndbm.c
+++ b/lib/libc/db/hash/ndbm.c
@@ -47,6 +47,7 @@ static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94";
#include <stdio.h>
#include <string.h>
+#include <errno.h>
#include <ndbm.h>
#include "hash.h"
@@ -70,6 +71,11 @@ dbm_open(file, flags, mode)
info.cachesize = 0;
info.hash = NULL;
info.lorder = 0;
+
+ if( strlen(file) >= sizeof(path) - strlen(DBM_SUFFIX)) {
+ errno = ENAMETOOLONG;
+ return(NULL);
+ }
(void)strcpy(path, file);
(void)strcat(path, DBM_SUFFIX);
return ((DBM *)__hash_open(path, flags, mode, &info, 0));