From: Ken Thomases Subject: [PATCH 1/4] ntdll: Increase name buffer size in read_directory_getattrlist() for UTF-8 encoding. Message-Id: <9F72989A-CC05-4E0D-93C6-2B1C51EEF4CC@codeweavers.com> Date: Wed, 20 May 2015 13:39:28 -0500 The docs for getattrlist() say that ATTR_CMN_NAME can return up to NAME_MAX + 1 Unicode characters (code points) encoded in UTF-8, which means it can be up to NAME_MAX * 3 + 1 bytes. --- dlls/ntdll/directory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 455fbc6..0e5af8a 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -2144,7 +2144,7 @@ static int read_directory_getattrlist( int fd, IO_STATUS_BLOCK *io, void *buffer { u_int32_t length; struct attrreference name_reference; - char name[NAME_MAX + 1]; + char name[NAME_MAX * 3 + 1]; } attrlist_buffer; TRACE("looking up file %s\n", debugstr_us( mask ));