diff options
-rwxr-xr-x | main/streams/streams.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c index 79f56f0cc4..29049a4bde 100755 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -1881,7 +1881,10 @@ PHPAPI int _php_stream_scandir(char *dirname, php_stream_dirent **namelist[], in vector = (php_stream_dirent **) erealloc(vector, vector_size * sizeof(php_stream_dirent *)); } - vector[nfiles++] = (php_stream_dirent*)estrndup((const char *)&sdp, sizeof(php_stream_dirent) + ((strlen(sdp.d_name) + 1) * sizeof(char))); + vector[nfiles] = emalloc(sizeof(php_stream_dirent)); + memcpy(vector[nfiles], &sdp, sizeof(sdp)); + + nfiles++; } php_stream_closedir(stream); |