Skip to content

Commit

Permalink
check_file_name_valid: bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
maharmstone committed Oct 2, 2021
1 parent 23536dd commit 8df7493
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/btrfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -5791,10 +5791,10 @@ NTSTATUS check_file_name_valid(_In_ PUNICODE_STRING us, _In_ bool posix, _In_ bo

/* Don't allow unpaired surrogates ("WTF-16") */

if ((us->Buffer[i] & 0xdc00) == 0xdc00 && (i == 0 || ((us->Buffer[i-1] & 0xd800) != 0xd800)))
if ((us->Buffer[i] & 0xfc00) == 0xdc00 && (i == 0 || ((us->Buffer[i-1] & 0xfc00) != 0xd800)))
return STATUS_OBJECT_NAME_INVALID;

if ((us->Buffer[i] & 0xd800) == 0xd800 && (i == (us->Length / sizeof(WCHAR) - 1) || ((us->Buffer[i+1] & 0xdc00) != 0xdc00)))
if ((us->Buffer[i] & 0xfc00) == 0xd800 && (i == (us->Length / sizeof(WCHAR)) - 1 || ((us->Buffer[i+1] & 0xfc00) != 0xdc00)))
return STATUS_OBJECT_NAME_INVALID;
}

Expand Down

0 comments on commit 8df7493

Please sign in to comment.