diff options
Diffstat (limited to 'libc/misc/ftw')
-rw-r--r-- | libc/misc/ftw/ftw.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c index 833821f22..605e07cd5 100644 --- a/libc/misc/ftw/ftw.c +++ b/libc/misc/ftw/ftw.c @@ -492,11 +492,14 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors, int flag char *cp; /* First make sure the parameters are reasonable. */ - if (dir[0] == '\0') - { + if (unlikely(dir==NULL || *dir=='\0')) { __set_errno (ENOENT); return -1; } + if ((strlen(dir)+1) > NAME_MAX) { + __set_errno(ENAMETOOLONG); + return -1; + } data.maxdir = descriptors < 1 ? 1 : descriptors; data.actdir = 0; |