diff options
| author | Joerg Wunsch <joerg@FreeBSD.org> | 1997-02-22 19:32:49 +0000 |
|---|---|---|
| committer | Joerg Wunsch <joerg@FreeBSD.org> | 1997-02-22 19:32:49 +0000 |
| commit | cce50feb48a36d4a625c9dfba0035264776abf56 (patch) | |
| tree | bf591b02a25da20dabbe246e7a07151b97510afc /lib | |
| parent | 15468857a886a41ef4d5d57513df8b4d713b279e (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libc/db/hash/ndbm.c | 6 |
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)); |
