From 3bc93e9353d8397c2867293dc8b71b8bc4b193e0 Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Tue, 26 Nov 2019 23:24:51 +0100 Subject: [PATCH] [MMC] DoSaveFileAs(): Respect szPath size (#2068) CORE-11688 --- base/applications/mmc/console.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/base/applications/mmc/console.c b/base/applications/mmc/console.c index 58d98ad5117..f56fbc546f3 100644 --- a/base/applications/mmc/console.c +++ b/base/applications/mmc/console.c @@ -18,6 +18,8 @@ */ #include "precomp.h" +#include +#include #include "resource.h" @@ -233,12 +235,12 @@ DoSaveFileAs( if (pChildInfo->pFileName != NULL) { - _tcscpy(szPath, pChildInfo->pFileName); + StringCbCopy(szPath, sizeof(szPath), pChildInfo->pFileName); } else { - GetWindowText(pChildInfo->hwnd, szPath, MAX_PATH); - _tcscat(szPath, TEXT(".msc")); + GetWindowText(pChildInfo->hwnd, szPath, _countof(szPath)); + StringCbCat(szPath, sizeof(szPath), TEXT(".msc")); } saveas.lStructSize = sizeof(OPENFILENAME);