From a3f407fb6cbb8a72c0eb4e5200d1ba90cd7d2232 Mon Sep 17 00:00:00 2001 From: sirakaba Date: Thu, 11 Nov 2010 14:04:16 +0000 Subject: [PATCH] =?utf8?q?=E6=94=B9=E8=A1=8C=E6=96=87=E5=AD=97=E3=82=84?= =?utf8?q?=E3=82=BF=E3=83=96=E6=96=87=E5=AD=97=E3=82=92=E5=90=8D=E5=89=8D?= =?utf8?q?=E3=81=AB=E5=90=AB=E3=82=80=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?utf8?q?=E3=82=92=E5=90=AB=E3=82=80=E6=9B=B8=E5=BA=AB=E3=82=92=E9=96=8B?= =?utf8?q?=E3=81=93=E3=81=86=E3=81=A8=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88?= =?utf8?q?=E3=81=AB=E8=AD=A6=E5=91=8A=E3=81=99=E3=82=8B=E6=A9=9F=E8=83=BD?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@433 9df91469-1e22-0410-86e7-ea8537beb833 --- src/lychee/frm_main.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/lychee/frm_main.cpp b/src/lychee/frm_main.cpp index 31d304a..3a02ef6 100644 --- a/src/lychee/frm_main.cpp +++ b/src/lychee/frm_main.cpp @@ -410,6 +410,7 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) piInfo.fiInfo.fnFileName = wxFileName(piInfo.fiInfo.szStoredName); } + // セキュリティチェック。 // ルート記号を削除。 wxString szPath = piInfo.fiInfo.fnFileName.GetPathWithSep(wxPATH_UNIX); if (szPath.StartsWith(wxT("/"))) @@ -417,11 +418,20 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) piInfo.fiInfo.fnFileName = wxFileName(szPath.AfterFirst(wxT('/')), piInfo.fiInfo.fnFileName.GetFullName(), wxPATH_DOS); } - // ツリービューに反映。 - bool fDir = piInfo.fiInfo.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false; - TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? piInfo.fiInfo.fnFileName.GetFullPath() : piInfo.fiInfo.fnFileName.GetPath(), true); + // 改行文字/タブ文字などを削除。 + if (piInfo.fiInfo.szStoredName.Find(wxT('\r')) != wxNOT_FOUND + || piInfo.fiInfo.szStoredName.Find(wxT('\n')) != wxNOT_FOUND + || piInfo.fiInfo.szStoredName.Find(wxT('\t')) != wxNOT_FOUND) + { + wxString sz = piInfo.fiInfo.fnFileName.GetFullPath(); + sz.Replace(wxT("\r"), wxT(" ")); + sz.Replace(wxT("\n"), wxT(" ")); + sz.Replace(wxT("\t"), wxT(" ")); + piInfo.fiInfo.eDanger = TRUE; + piInfo.fiInfo.fnFileName = wxFileName(sz); + wxLogWarning(_("This archive may contain files whose name contains some special characters like CR(\\r), LF(\\n), Tab(\\t) and some problem would be happen if you extract these files. Don\'t extract these files carelessly.\nDanger file is:\n%s"), piInfo.fiInfo.fnFileName.GetFullPath().c_str()); + } - // セキュリティチェック。 // DTV検査。 if (piInfo.fiInfo.fnFileName.GetPathWithSep(wxPATH_UNIX).Find(wxT("../")) != wxNOT_FOUND) { @@ -449,6 +459,10 @@ void MainFrame::OnArcOpen(wxCommandEvent& e) } } + // ツリービューに反映。 + bool fDir = piInfo.fiInfo.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false; + TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? piInfo.fiInfo.fnFileName.GetFullPath() : piInfo.fiInfo.fnFileName.GetPath(), true); + // ディレクトリ属性を含むものについては情報を保存しない。 if (fDir) { -- 2.11.0