Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Fix SVACE defect in IoT.js (fs.scandir) #122

Merged
merged 1 commit into from
Aug 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
cnt++;
}

if (cnt > 0 && dents == NULL) {
closedir(dir);
cnt = -1;
goto error;
}

/* Allcoate memory for the directory entries. */
dents = (uv__dirent_t**) malloc(sizeof (uv__dirent_t*) * cnt);

Expand Down