mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Protect against an overly-large length. Patch from brendan, bug 335535, r=mrbkap
This commit is contained in:
parent
05a259f259
commit
0cf9f4ba99
@ -2066,6 +2066,11 @@ tagify(JSContext *cx, JSObject *obj, jsval *argv,
|
||||
endlen = strlen(end);
|
||||
taglen += JSSTRING_LENGTH(str) + 2 + endlen + 1; /* 'str</end>' */
|
||||
|
||||
if (taglen >= ~(size_t)0 / sizeof(jschar)) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
tagbuf = (jschar *) JS_malloc(cx, (taglen + 1) * sizeof(jschar));
|
||||
if (!tagbuf)
|
||||
return JS_FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user