Fixes bug #45877. r=mstoltz.

git-svn-id: svn://10.0.0.236/trunk@76081 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jtaylor%netscape.com
2000-08-11 03:11:24 +00:00
parent 21c98fdd2d
commit 0a53eb51a1

View File

@@ -1083,6 +1083,14 @@ nsScriptSecurityManager::EnableCapability(const char *capability)
EnsurePrefsLoaded();
JSContext *cx = GetCurrentContext();
JSStackFrame *fp;
//Error checks for capability string length (200)
if(PL_strlen(capability)>200) {
static const char msg[] = "Capability name too long";
JS_SetPendingException(cx, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, msg)));
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIPrincipal> principal;
if (NS_FAILED(GetPrincipalAndFrame(cx, getter_AddRefs(principal),
&fp)))