diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-11-08 06:33:36 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-11-08 06:33:36 +0000 |
commit | b36d61d33ece9afa32733bbcc7def4cb4afc4856 (patch) | |
tree | 70c95467dd06edb899c683697b7de2955e699f73 /libc/misc/ftw | |
parent | a48d269edabfdf3de5253595568f7dce788b2beb (diff) |
Fix up several errors related to filename length and errno that
showed up while running the latest LTP testsuite.
-Erik
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; |