Check string length correctly in wxFileSystem::URLToFileName().

Check that the string is long enough before accessing its first and second
characters to fix a crash when an empty or one-character string was passed to
wxFileSystem::URLToFileName().

Closes #13920.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2012-02-03 17:27:21 +00:00
parent 1dcca9b51e
commit 9b42a9adc2

View File

@ -639,7 +639,7 @@ wxFileName wxFileSystem::URLToFileName(const wxString& url)
// file urls either start with a forward slash (local harddisk),
// otherwise they have a servername/sharename notation,
// which only exists on msw and corresponds to a unc
if ( path[0u] == wxT('/') && path [1u] != wxT('/'))
if ( path.length() > 1 && (path[0u] == wxT('/') && path [1u] != wxT('/')) )
{
path = path.Mid(1);
}