[MMC] DoSaveFileAs(): Respect szPath size (#2068)

CORE-11688
This commit is contained in:
Serge Gautherie 2019-11-26 23:24:51 +01:00 committed by Katayama Hirofumi MZ
parent cfdbccf937
commit 3bc93e9353

View file

@ -18,6 +18,8 @@
*/ */
#include "precomp.h" #include "precomp.h"
#include <stdlib.h>
#include <strsafe.h>
#include "resource.h" #include "resource.h"
@ -233,12 +235,12 @@ DoSaveFileAs(
if (pChildInfo->pFileName != NULL) if (pChildInfo->pFileName != NULL)
{ {
_tcscpy(szPath, pChildInfo->pFileName); StringCbCopy(szPath, sizeof(szPath), pChildInfo->pFileName);
} }
else else
{ {
GetWindowText(pChildInfo->hwnd, szPath, MAX_PATH); GetWindowText(pChildInfo->hwnd, szPath, _countof(szPath));
_tcscat(szPath, TEXT(".msc")); StringCbCat(szPath, sizeof(szPath), TEXT(".msc"));
} }
saveas.lStructSize = sizeof(OPENFILENAME); saveas.lStructSize = sizeof(OPENFILENAME);