mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[RTL] Properly truncate 8dot3 names when using a MultiByte OEM code page
CORE-17571
This commit is contained in:
parent
49fcbe7cd8
commit
30f2ad7949
1 changed files with 13 additions and 3 deletions
|
@ -102,8 +102,9 @@ RtlGenerate8dot3Name(IN PUNICODE_STRING Name,
|
|||
DotPos = Index;
|
||||
}
|
||||
|
||||
/* Copy name (6 valid characters max) */
|
||||
for (Index = 0; Index < DotPos && Context->NameLength < 6; Index++)
|
||||
/* Copy name. OEM string length can't exceed 6. */
|
||||
UCHAR OemSizeLeft = 6;
|
||||
for (Index = 0; (Index < DotPos) && OemSizeLeft; Index++)
|
||||
{
|
||||
Char = Name->Buffer[Index];
|
||||
|
||||
|
@ -115,8 +116,17 @@ RtlGenerate8dot3Name(IN PUNICODE_STRING Name,
|
|||
else if (Char >= L'a' && Char <= L'z')
|
||||
Char = RtlpUpcaseUnicodeChar(Char);
|
||||
|
||||
/* Beware of MB OEM codepage */
|
||||
if (NlsMbOemCodePageTag && HIBYTE(NlsUnicodeToMbOemTable[Char]))
|
||||
{
|
||||
if (OemSizeLeft < 2)
|
||||
break;
|
||||
OemSizeLeft--;
|
||||
}
|
||||
|
||||
Context->NameBuffer[Context->NameLength] = Char;
|
||||
++Context->NameLength;
|
||||
Context->NameLength++;
|
||||
OemSizeLeft--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue