dll: fuse: change name limit to 255 chars

Fixes #191
Fixes #455
This commit is contained in:
zeho11 2022-12-07 14:39:36 +09:00 committed by GitHub
parent 01d9fa1719
commit b62e1e920b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));