]> granicus.if.org Git - php/commitdiff
Refine allocation
authorAnatol Belski <ab@php.net>
Wed, 15 Nov 2017 17:02:01 +0000 (18:02 +0100)
committerAnatol Belski <ab@php.net>
Wed, 15 Nov 2017 17:02:01 +0000 (18:02 +0100)
None of currently supported codepages would claim more than 5
bytes per a multibyte glyph, that's (255*5+1)kb, not 2kb anymore.

win32/readdir.c

index a3f20f7f3d4269d955392dec41edc9691fee4784..146ab54ff51263badade7fa9255419f2a66ece85 100644 (file)
@@ -37,7 +37,7 @@ DIR *opendir(const char *dir)
                return NULL;
        }
 
-       dp = (DIR *) calloc(1, sizeof(DIR) + MAXPATHLEN*sizeof(char));
+       dp = (DIR *) calloc(1, sizeof(DIR) + (_MAX_FNAME*5+1)*sizeof(char));
        if (dp == NULL) {
                return NULL;
        }