From b62e1e920b292c4928395db89e96fada29dd7c38 Mon Sep 17 00:00:00 2001 From: zeho11 <73569575+zeho11@users.noreply.github.com> Date: Wed, 7 Dec 2022 14:39:36 +0900 Subject: [PATCH] dll: fuse: change name limit to 255 chars Fixes #191 Fixes #455 --- src/dll/fuse/fuse_intf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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));