From c2ba6a3794fdb58d70886e582ffe698adeb2fd6a Mon Sep 17 00:00:00 2001 From: berryzplus Date: Fri, 5 Mar 2021 23:35:21 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=BC=E3=81=97?= =?UTF-8?q?=E3=81=9F=E6=96=87=E5=AD=97=E5=88=97=E3=81=AE=E5=BE=8C=E3=81=AB?= =?UTF-8?q?NUL=E7=B5=82=E7=AB=AF=E3=82=92=E4=BB=98=E5=8A=A0=E3=81=99?= =?UTF-8?q?=E3=82=8B=E5=87=A6=E7=90=86=E3=82=92=E5=AE=89=E5=85=A8=E3=81=AA?= =?UTF-8?q?=E5=AE=9F=E8=A3=85=E3=81=AB=E6=9B=B8=E3=81=8D=E6=9B=BF=E3=81=88?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/CBackupAgent.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sakura_core/CBackupAgent.cpp b/sakura_core/CBackupAgent.cpp index 7eb8e15c98..f3ce33bb45 100644 --- a/sakura_core/CBackupAgent.cpp +++ b/sakura_core/CBackupAgent.cpp @@ -256,8 +256,7 @@ int CBackupAgent::MakeBackUp( //@@@ 2001.12.11 start MIK if( bup_setting.m_bBackUpDustBox && !dustflag ){ //@@@ 2002.03.23 ネットワーク・リムーバブルドライブでない WCHAR szDustPath[_MAX_PATH+1]; - wcscpy(szDustPath, szPath); - szDustPath[wcslen(szDustPath) + 1] = L'\0'; + ::wcscpy_s(szDustPath, szPath); SHFILEOPSTRUCT fos; fos.hwnd = CEditWnd::getInstance()->GetHwnd(); fos.wFunc = FO_DELETE; From ee22ebf2345f0e454ba902f0437a9c38c771f1b7 Mon Sep 17 00:00:00 2001 From: berryzplus Date: Fri, 5 Mar 2021 23:51:24 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E6=80=AA=E3=81=97=E3=81=92=E3=81=AA?= =?UTF-8?q?=E3=83=9D=E3=82=A4=E3=83=B3=E3=82=BF=E6=93=8D=E4=BD=9C=E3=82=92?= =?UTF-8?q?=E7=B0=A1=E5=8D=98=E3=81=AA=E9=96=A2=E6=95=B0=E5=91=BC=E5=87=BA?= =?UTF-8?q?=E3=81=A7=E7=BD=AE=E6=8F=9B=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 小規模リファクタリングで収めるため、本質的な怪しさはスルーしてしまう。 --- sakura_core/CBackupAgent.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sakura_core/CBackupAgent.cpp b/sakura_core/CBackupAgent.cpp index f3ce33bb45..72a138a386 100644 --- a/sakura_core/CBackupAgent.cpp +++ b/sakura_core/CBackupAgent.cpp @@ -432,11 +432,9 @@ bool CBackupAgent::FormatBackUpPath( else { ptr = szExt + wcslen( szExt ); } - *ptr = L'.'; - *++ptr = bup_setting.GetBackupExtChar(); - *++ptr = L'0'; - *++ptr = L'0'; - *++ptr = L'\0'; + // _MAX_EXT = 256なので桁溢れは考慮しない。 + const WCHAR tmp[] = { L'.', bup_setting.GetBackupExtChar(), L'0', L'0', 0 }; + ptr += auto_snprintf_s(ptr, _countof(tmp), L"%s", tmp); } if( -1 == auto_snprintf_s( pBase, nBaseCount, L"%s%s", szFname, szExt ) ){ return false; From ad53940621c3c6964ca53d714dfeeeebaa12eb88 Mon Sep 17 00:00:00 2001 From: berryzplus Date: Sat, 6 Mar 2021 00:54:47 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E7=84=A1=E9=A7=84=E3=81=AB=E3=83=9D?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=82=92=E9=80=B2=E3=82=81=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=81=9F=E3=81=AE=E3=82=92=E3=82=84=E3=82=81=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sakura_core/CBackupAgent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sakura_core/CBackupAgent.cpp b/sakura_core/CBackupAgent.cpp index 72a138a386..8b3f9fa5c6 100644 --- a/sakura_core/CBackupAgent.cpp +++ b/sakura_core/CBackupAgent.cpp @@ -434,7 +434,7 @@ bool CBackupAgent::FormatBackUpPath( } // _MAX_EXT = 256なので桁溢れは考慮しない。 const WCHAR tmp[] = { L'.', bup_setting.GetBackupExtChar(), L'0', L'0', 0 }; - ptr += auto_snprintf_s(ptr, _countof(tmp), L"%s", tmp); + auto_snprintf_s(ptr, _countof(tmp), L"%s", tmp); } if( -1 == auto_snprintf_s( pBase, nBaseCount, L"%s%s", szFname, szExt ) ){ return false;