From 9b42a9adc276b9f0e09c556d165190104afe5c64 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 3 Feb 2012 17:27:21 +0000 Subject: [PATCH] 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 --- src/common/filesys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index f94b3f5d91..9f5a7c9a24 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -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); }