Skip to content

Commit 0087880

Browse files
committed
fix: subtract FileNameLength size from buffer length
1 parent 7b052c5 commit 0087880

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

deadlock-dotnet-sdk/Domain/SafeFileHandleEx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ public unsafe (string? v, Exception? ex) FileNameInfo
422422
{
423423
Buffer = new PWSTR((char*)(((FILE_NAME_INFO*)safeBuffer.DangerousGetHandle()) + sizeof(int))),
424424
Length = (ushort)fni.FileNameLength,
425-
MaximumLength = (ushort)bufferLength
425+
MaximumLength = (ushort)(bufferLength - sizeof(int))
426426
};
427427

428428
/* The string conversion copies the data to a new string in the managed heap before freeing safeBuffer and leaving this context. */

0 commit comments

Comments
 (0)