Skip to content

Commit 05626ba

Browse files
committed
Explicitly initialize all dir entries
1 parent 19924fc commit 05626ba

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

ext/phar/dirstream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ static ssize_t phar_dir_read(php_stream *stream, char *buf, size_t count) /* {{{
108108
memset(buf, 0, sizeof(php_stream_dirent));
109109
memcpy(((php_stream_dirent *) buf)->d_name, ZSTR_VAL(str_key), to_read);
110110
((php_stream_dirent *) buf)->d_name[to_read + 1] = '\0';
111+
((php_stream_dirent *) buf)->d_type = DT_UNKNOWN;
111112

112113
return sizeof(php_stream_dirent);
113114
}

ext/standard/ftp_fopen_wrapper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ static ssize_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t coun
629629
memcpy(ent->d_name, ZSTR_VAL(basename), tmp_len);
630630
ent->d_name[tmp_len - 1] = '\0';
631631
zend_string_release_ex(basename, 0);
632+
ent->d_type = DT_UNKNOWN;
632633

633634
/* Trim off trailing whitespace characters */
634635
while (tmp_len > 0 &&

main/streams/glob_wrapper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ static ssize_t php_glob_stream_read(php_stream *stream, char *buf, size_t count)
150150
php_glob_stream_path_split(pglob, pglob->glob.gl_pathv[index], pglob->flags & GLOB_APPEND, &path);
151151
++pglob->index;
152152
PHP_STRLCPY(ent->d_name, path, sizeof(ent->d_name), strlen(path));
153+
ent->d_type = DT_UNKNOWN;
153154
return sizeof(php_stream_dirent);
154155
}
155156
pglob->index = glob_result_count;

main/streams/userspace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,7 @@ static ssize_t php_userstreamop_readdir(php_stream *stream, char *buf, size_t co
13201320
if (call_result == SUCCESS && Z_TYPE(retval) != IS_FALSE && Z_TYPE(retval) != IS_TRUE) {
13211321
convert_to_string(&retval);
13221322
PHP_STRLCPY(ent->d_name, Z_STRVAL(retval), sizeof(ent->d_name), Z_STRLEN(retval));
1323+
ent->d_type = DT_UNKNOWN;
13231324

13241325
didread = sizeof(php_stream_dirent);
13251326
} else if (call_result == FAILURE) {

0 commit comments

Comments
 (0)