X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsystems%2Fwin32%2Fwin32k%2Fobjects%2Ffreetype.c;h=c7086fd39d41c5525f37a4e96db8968f75073702;hp=4e941ee20470efc79f4cf1a3120a8c42f906f85f;hb=61b6e9119ff21538e56f345b60f8f0293ef6d39d;hpb=03a8c91d75885f47c18e9991ab5ceb74cb76b75c diff --git a/reactos/subsystems/win32/win32k/objects/freetype.c b/reactos/subsystems/win32/win32k/objects/freetype.c index 4e941ee2047..c7086fd39d4 100644 --- a/reactos/subsystems/win32/win32k/objects/freetype.c +++ b/reactos/subsystems/win32/win32k/objects/freetype.c @@ -1078,12 +1078,16 @@ FontFamilyFillInfo(PFONTFAMILYINFO Info, PCWSTR FaceName, PFONTGDI FontGDI) ExFreePoolWithTag(Otm, GDITAG_TEXT); - wcsncpy(Info->EnumLogFontEx.elfLogFont.lfFaceName, FaceName, LF_FACESIZE); - wcsncpy(Info->EnumLogFontEx.elfFullName, FaceName, LF_FULLFACESIZE); + RtlStringCbCopyW(Info->EnumLogFontEx.elfLogFont.lfFaceName, + sizeof(Info->EnumLogFontEx.elfLogFont.lfFaceName), + FaceName); + RtlStringCbCopyW(Info->EnumLogFontEx.elfFullName, + sizeof(Info->EnumLogFontEx.elfFullName), + FaceName); RtlInitAnsiString(&StyleA, FontGDI->face->style_name); - RtlAnsiStringToUnicodeString(&StyleW, &StyleA, TRUE); - wcsncpy(Info->EnumLogFontEx.elfStyle, StyleW.Buffer, LF_FACESIZE); - RtlFreeUnicodeString(&StyleW); + StyleW.Buffer = Info->EnumLogFontEx.elfStyle; + StyleW.MaximumLength = sizeof(Info->EnumLogFontEx.elfStyle); + RtlAnsiStringToUnicodeString(&StyleW, &StyleA, FALSE); Info->EnumLogFontEx.elfLogFont.lfCharSet = DEFAULT_CHARSET; Info->EnumLogFontEx.elfScript[0] = L'\0'; @@ -1267,8 +1271,10 @@ FontFamilyInfoQueryRegistryCallback(IN PWSTR ValueName, IN ULONG ValueType, if (InfoContext->Count < InfoContext->Size) { InfoContext->Info[InfoContext->Count] = InfoContext->Info[Existing]; - wcsncpy(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName, - RegistryName.Buffer, LF_FACESIZE); + RtlStringCbCopyNW(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName, + sizeof(InfoContext->Info[InfoContext->Count].EnumLogFontEx.elfLogFont.lfFaceName), + RegistryName.Buffer, + RegistryName.Length); } InfoContext->Count++; return STATUS_SUCCESS; @@ -2643,7 +2649,7 @@ FindBestFontFromList(FONTOBJ **FontObj, UINT *MatchScore, LOGFONTW *LogFont, PFONT_ENTRY CurrentEntry; FONTGDI *FontGDI; UINT Score; - +ASSERT(FontObj && MatchScore && LogFont && FaceName && Head); Entry = Head->Flink; while (Entry != Head) {