https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3bc93e9353d8397c28672…
commit 3bc93e9353d8397c2867293dc8b71b8bc4b193e0
Author:     Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Tue Nov 26 23:24:51 2019 +0100
Commit:     Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Wed Nov 27 07:24:51 2019 +0900
    [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 <stdlib.h>
+#include <strsafe.h>
 #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);