Fixes bug #45877. r=mstoltz.

This commit is contained in:
jtaylor%netscape.com 2000-08-11 03:11:24 +00:00
parent 13489f9186
commit e2560fe87a

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)))