]> granicus.if.org Git - php/commitdiff
Fix #36365: scandir duplicates file name at every 65535th file
authorChristoph M. Becker <cmb@php.net>
Thu, 23 Jul 2015 12:11:28 +0000 (14:11 +0200)
committerChristoph M. Becker <cmb@php.net>
Mon, 27 Jul 2015 23:04:55 +0000 (01:04 +0200)
Due to DIR.offset being declared as short we have an overflow. This patch
changes the field to int.

win32/readdir.h

index f1fb3a736fec798ed182d5affc24ba3eadaee332..d9ae477af08284068554ccc607a341162eb2d3de 100644 (file)
@@ -32,7 +32,7 @@ struct dirent {
 /* typedef DIR - not the same as Unix */
 typedef struct {
        HANDLE handle;                          /* _findfirst/_findnext handle */
-       short offset;                           /* offset into directory */
+       int offset;                                     /* offset into directory */
        short finished;                         /* 1 if there are not more files */
        WIN32_FIND_DATA fileinfo;       /* from _findfirst/_findnext */
        char *dir;                                      /* the dir we are reading */