dll: fuse: correct error handling when name exceeds limit

Related to b62e1e920b
This commit is contained in:
zeho11
2022-12-12 12:08:48 +09:00
committed by GitHub
parent 46054c03fe
commit e550e261f0

View File

@ -1949,18 +1949,16 @@ int fsp_fuse_intf_AddDirInfo(void *buf, const char *name,
SizeW = MultiByteToWideChar(CP_UTF8, 0, name, SizeA, DirInfo->FileNameBuf, 255);
if (0 == SizeW)
{
fsp_fuse_intf_LogBadDirInfo(filedesc->PosixPath, name,
"MultiByteToWideChar failed");
return 0;
}
else if (255 == SizeW)
{
if (255 < MultiByteToWideChar(CP_UTF8, 0, name, SizeA, NULL, 0))
if (ERROR_INSUFFICIENT_BUFFER == GetLastError())
{
fsp_fuse_intf_LogBadDirInfo(filedesc->PosixPath, name,
"too long");
return 0;
}
fsp_fuse_intf_LogBadDirInfo(filedesc->PosixPath, name,
"MultiByteToWideChar failed");
return 0;
}
memset(DirInfo, 0, sizeof *DirInfo);