Bug 710975 - Bad index checking in nsIEProfileMigrator::TestForIE7(). r=gavin

This commit is contained in:
Tim Taubert 2012-01-08 03:07:48 -08:00
parent 876c18b050
commit d386d01d3c

View File

@ -99,6 +99,8 @@
#include "nsIWindowsRegKey.h"
#include "nsISupportsPrimitives.h"
#define kNotFound -1
#define TRIDENTPROFILE_BUNDLE "chrome://browser/locale/migration/migration.properties"
#define REGISTRY_IE_MAIN_KEY \
@ -602,9 +604,13 @@ nsIEProfileMigrator::TestForIE7()
iePath = destination;
// Check if the path is enclosed in quotation marks.
if (StringBeginsWith(iePath, NS_LITERAL_STRING("\""))) {
iePath.Cut(0,1);
PRUint32 index = iePath.FindChar('\"', 0);
PRInt32 index = iePath.FindChar('\"', 0);
// After removing the opening quoation mark,
// remove the closing one and everything after it.
if (index > 0)
iePath.Cut(index,iePath.Length());
}
@ -621,8 +627,8 @@ nsIEProfileMigrator::TestForIE7()
return false;
if (ieVersion.Length() > 2) {
PRUint32 index = ieVersion.FindChar('.', 0);
if (index < 0)
PRInt32 index = ieVersion.FindChar('.', 0);
if (index == kNotFound)
return false;
ieVersion.Cut(index, ieVersion.Length());
PRInt32 ver = wcstol(ieVersion.get(), nsnull, 0);