[MMC] DoSaveFileAs(): Respect szPath size (#2068)
authorSerge Gautherie <32623169+SergeGautherie@users.noreply.github.com>
Tue, 26 Nov 2019 22:24:51 +0000 (23:24 +0100)
committerKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Tue, 26 Nov 2019 22:24:51 +0000 (07:24 +0900)
CORE-11688

base/applications/mmc/console.c

index 58d98ad..f56fbc5 100644 (file)
@@ -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);