diff options
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/fts.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index ae4bc3f5d1e..62b815fd2f0 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fts.c,v 1.41 2008/12/27 12:30:13 pedro Exp $ */ +/* $OpenBSD: fts.c,v 1.42 2009/02/11 13:24:05 otto Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -633,6 +633,14 @@ fts_build(FTS *sp, int type) len++; maxlen = sp->fts_pathlen - len; + if (cur->fts_level == SHRT_MAX) { + (void)closedir(dirp); + cur->fts_info = FTS_ERR; + SET(FTS_STOP); + errno = ENAMETOOLONG; + return (NULL); + } + level = cur->fts_level + 1; /* Read the directory, attaching each entry to the `link' pointer. */ |