[CONSRV]: Use string-safe functions to copy the font names into the fixed-size buffers.

svn path=/trunk/; revision=74463
This commit is contained in:
Hermès Bélusca-Maïto 2017-05-03 19:57:28 +00:00
parent 8928ef6200
commit c1934a3a17
3 changed files with 6 additions and 4 deletions

View file

@ -12,6 +12,8 @@
/* Main header */ /* Main header */
#include "../winsrv.h" #include "../winsrv.h"
#include <strsafe.h>
/* PSDK/NDK Headers */ /* PSDK/NDK Headers */
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#define _INC_WINDOWS #define _INC_WINDOWS

View file

@ -161,8 +161,8 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData,
pSharedInfo->CodePage = Console->OutputCodePage; pSharedInfo->CodePage = Console->OutputCodePage;
/* GUI Information */ /* GUI Information */
wcsncpy(pSharedInfo->FaceName, GuiData->GuiInfo.FaceName, LF_FACESIZE); StringCchCopyNW(pSharedInfo->FaceName, ARRAYSIZE(pSharedInfo->FaceName),
pSharedInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL; GuiData->GuiInfo.FaceName, ARRAYSIZE(GuiData->GuiInfo.FaceName));
pSharedInfo->FontFamily = GuiData->GuiInfo.FontFamily; pSharedInfo->FontFamily = GuiData->GuiInfo.FontFamily;
pSharedInfo->FontSize = GuiData->GuiInfo.FontSize; pSharedInfo->FontSize = GuiData->GuiInfo.FontSize;
pSharedInfo->FontWeight = GuiData->GuiInfo.FontWeight; pSharedInfo->FontWeight = GuiData->GuiInfo.FontWeight;

View file

@ -1272,8 +1272,8 @@ GuiLoadFrontEnd(IN OUT PFRONTEND FrontEnd,
#endif #endif
// Font data // Font data
wcsncpy(GuiInitInfo->TermInfo.FaceName, ConsoleInfo->FaceName, LF_FACESIZE); StringCchCopyNW(GuiInitInfo->TermInfo.FaceName, ARRAYSIZE(GuiInitInfo->TermInfo.FaceName),
GuiInitInfo->TermInfo.FaceName[LF_FACESIZE - 1] = UNICODE_NULL; ConsoleInfo->FaceName, ARRAYSIZE(ConsoleInfo->FaceName));
GuiInitInfo->TermInfo.FontFamily = ConsoleInfo->FontFamily; GuiInitInfo->TermInfo.FontFamily = ConsoleInfo->FontFamily;
GuiInitInfo->TermInfo.FontSize = ConsoleInfo->FontSize; GuiInitInfo->TermInfo.FontSize = ConsoleInfo->FontSize;
GuiInitInfo->TermInfo.FontWeight = ConsoleInfo->FontWeight; GuiInitInfo->TermInfo.FontWeight = ConsoleInfo->FontWeight;