mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 666224 - Fix off-by-one error when checking nsCommandLine::GetArgument aIndex argument. r=bsmedberg
This commit is contained in:
parent
205bc10c08
commit
cfdb7c5679
@ -132,7 +132,7 @@ NS_IMETHODIMP
|
||||
nsCommandLine::GetArgument(PRInt32 aIndex, nsAString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aIndex, 0);
|
||||
NS_ENSURE_ARG_MAX(PRUint32(aIndex), mArgs.Length());
|
||||
NS_ENSURE_ARG_MAX(aIndex, PRInt32(mArgs.Length() - 1));
|
||||
|
||||
aResult = mArgs[aIndex];
|
||||
return NS_OK;
|
||||
|
@ -0,0 +1,6 @@
|
||||
function run_test() {
|
||||
var cmdLine=Components.classes["@mozilla.org/toolkit/command-line;1"].createInstance(Components.interfaces.nsICommandLine);
|
||||
try {
|
||||
cmdLine.getArgument(cmdLine.length);
|
||||
} catch(e) {}
|
||||
}
|
@ -3,3 +3,4 @@ head =
|
||||
tail =
|
||||
|
||||
[test_classinfo.js]
|
||||
[test_bug666224.js]
|
||||
|
Loading…
Reference in New Issue
Block a user