mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 713485 - Crash when invalid drive is used in local file URL. r=neil.
This commit is contained in:
parent
ad5a8e1d06
commit
996395af69
@ -874,6 +874,14 @@ nsLocalFile::InitWithPath(const nsAString &filePath)
|
||||
if (secondChar != L':' && (secondChar != L'\\' || firstChar != L'\\'))
|
||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||
|
||||
if (secondChar == L':') {
|
||||
// Make sure we have a valid drive, later code assumes the drive letter
|
||||
// is a single char a-z or A-Z.
|
||||
if (PathGetDriveNumberW(filePath.Data()) == -1) {
|
||||
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
mWorkingPath = filePath;
|
||||
// kill any trailing '\'
|
||||
if (mWorkingPath.Last() == L'\\')
|
||||
@ -2467,7 +2475,7 @@ nsLocalFile::IsExecutable(bool *_retval)
|
||||
"wsf",
|
||||
"wsh"};
|
||||
nsDependentSubstring ext = Substring(path, dotIdx + 1);
|
||||
for ( int i = 0; i < ArrayLength(executableExts); i++ ) {
|
||||
for ( size_t i = 0; i < ArrayLength(executableExts); i++ ) {
|
||||
if ( ext.EqualsASCII(executableExts[i])) {
|
||||
// Found a match. Set result and quit.
|
||||
*_retval = true;
|
||||
|
Loading…
Reference in New Issue
Block a user