From c1934a3a170bd045958086f3026ec27854842f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Wed, 3 May 2017 19:57:28 +0000 Subject: [PATCH] [CONSRV]: Use string-safe functions to copy the font names into the fixed-size buffers. svn path=/trunk/; revision=74463 --- reactos/win32ss/user/winsrv/consrv/consrv.h | 2 ++ .../win32ss/user/winsrv/consrv/frontends/gui/guisettings.c | 4 ++-- reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/reactos/win32ss/user/winsrv/consrv/consrv.h b/reactos/win32ss/user/winsrv/consrv/consrv.h index 451f0289c5e..c17573e8e04 100644 --- a/reactos/win32ss/user/winsrv/consrv/consrv.h +++ b/reactos/win32ss/user/winsrv/consrv/consrv.h @@ -12,6 +12,8 @@ /* Main header */ #include "../winsrv.h" +#include + /* PSDK/NDK Headers */ #define WIN32_NO_STATUS #define _INC_WINDOWS diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c index b4574192bfd..b61d84e86c4 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guisettings.c @@ -161,8 +161,8 @@ GuiConsoleShowConsoleProperties(PGUI_CONSOLE_DATA GuiData, pSharedInfo->CodePage = Console->OutputCodePage; /* GUI Information */ - wcsncpy(pSharedInfo->FaceName, GuiData->GuiInfo.FaceName, LF_FACESIZE); - pSharedInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(pSharedInfo->FaceName, ARRAYSIZE(pSharedInfo->FaceName), + GuiData->GuiInfo.FaceName, ARRAYSIZE(GuiData->GuiInfo.FaceName)); pSharedInfo->FontFamily = GuiData->GuiInfo.FontFamily; pSharedInfo->FontSize = GuiData->GuiInfo.FontSize; pSharedInfo->FontWeight = GuiData->GuiInfo.FontWeight; diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c index d479a5a31ee..1258b792f85 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c @@ -1272,8 +1272,8 @@ GuiLoadFrontEnd(IN OUT PFRONTEND FrontEnd, #endif // Font data - wcsncpy(GuiInitInfo->TermInfo.FaceName, ConsoleInfo->FaceName, LF_FACESIZE); - GuiInitInfo->TermInfo.FaceName[LF_FACESIZE - 1] = UNICODE_NULL; + StringCchCopyNW(GuiInitInfo->TermInfo.FaceName, ARRAYSIZE(GuiInitInfo->TermInfo.FaceName), + ConsoleInfo->FaceName, ARRAYSIZE(ConsoleInfo->FaceName)); GuiInitInfo->TermInfo.FontFamily = ConsoleInfo->FontFamily; GuiInitInfo->TermInfo.FontSize = ConsoleInfo->FontSize; GuiInitInfo->TermInfo.FontWeight = ConsoleInfo->FontWeight;