diff --git a/src/dll/fuse/fuse_intf.c b/src/dll/fuse/fuse_intf.c index 5ee5d739..e6f247c8 100644 --- a/src/dll/fuse/fuse_intf.c +++ b/src/dll/fuse/fuse_intf.c @@ -1939,7 +1939,7 @@ int fsp_fuse_intf_AddDirInfo(void *buf, const char *name, } SizeA = lstrlenA(name); - if (SizeA > 255) + if (SizeA > 1020) { fsp_fuse_intf_LogBadDirInfo(filedesc->PosixPath, name, "too long"); @@ -1953,6 +1953,15 @@ int fsp_fuse_intf_AddDirInfo(void *buf, const char *name, "MultiByteToWideChar failed"); return 0; } + else if (255 == SizeW) + { + if (255 < MultiByteToWideChar(CP_UTF8, 0, name, SizeA, NULL, 0)) + { + fsp_fuse_intf_LogBadDirInfo(filedesc->PosixPath, name, + "too long"); + return 0; + } + } memset(DirInfo, 0, sizeof *DirInfo); DirInfo->Size = (UINT16)(sizeof(FSP_FSCTL_DIR_INFO) + SizeW * sizeof(WCHAR));