sc/source/ui/dbgui/scuiasciiopt.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
New commits: commit d340d3bbcf12729adb2cd3a847bc474e3d58b286 Author: Eike Rathke <er...@redhat.com> Date: Thu Dec 19 17:33:29 2013 +0100 check string length of file name before attempting to copy File names CAN be shorter than 4 characters if they don't have a 3 character file name extension and the filter was selected. Change-Id: Ic25bdf44cd44d48313c748525e75318e05240e8e diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 1cd49d6..6ecdcf6 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -292,11 +292,15 @@ ScImportAsciiDlg::ScImportAsciiDlg( Window* pParent,OUString aDatName, bool bIsCSV = false; bool bIsTSV = false; - OUString aExtWithDot = aDatName.copy(aDatName.getLength() - 4); // All handled extensions (csv, tsv, tab) have length of 3 - if ( aExtWithDot.equalsIgnoreAsciiCase(".tsv") || aExtWithDot.equalsIgnoreAsciiCase(".tab") ) - bIsTSV = true; - else if ( aExtWithDot.equalsIgnoreAsciiCase(".csv") ) - bIsCSV = true; + if (aDatName.getLength() >= 4) + { + // All handled extensions (csv, tsv, tab) have length of 3 + OUString aExtWithDot = aDatName.copy(aDatName.getLength() - 4); + if ( aExtWithDot.equalsIgnoreAsciiCase(".tsv") || aExtWithDot.equalsIgnoreAsciiCase(".tab") ) + bIsTSV = true; + else if ( aExtWithDot.equalsIgnoreAsciiCase(".csv") ) + bIsCSV = true; + } // Default options are set in officecfg/registry/schema/org/openoffice/Office/Calc.xcs OUString sFieldSeparators(",;\t"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits