mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-30 04:29:01 +01:00
Fix segfault upon invalid scandir
This commit is contained in:
parent
8c0953ba85
commit
389e5c2f25
12
php_uv.c
12
php_uv.c
@ -1764,11 +1764,15 @@ static void php_uv_fs_cb(uv_fs_t* req)
|
||||
}
|
||||
case UV_FS_SCANDIR:
|
||||
{
|
||||
uv_dirent_t dent;
|
||||
if (Z_RES(params[0]) && req->ptr != NULL) {
|
||||
uv_dirent_t dent;
|
||||
|
||||
array_init(¶ms[1]);
|
||||
while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
|
||||
add_next_index_string(¶ms[1], dent.name);
|
||||
array_init(¶ms[1]);
|
||||
while (UV_EOF != uv_fs_scandir_next(req, &dent)) {
|
||||
add_next_index_string(¶ms[1], dent.name);
|
||||
}
|
||||
} else {
|
||||
ZVAL_NULL(¶ms[1]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user