mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fix write past buffer length for proxy toString operation.
This commit is contained in:
parent
4887fc7c9e
commit
6c6d070dab
1 changed files with 1 additions and 1 deletions
|
@ -62,7 +62,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
|||
unsafe {
|
||||
let name = str::raw::from_buf(className as *u8);
|
||||
let nchars = "[object ]".len() + name.len();
|
||||
let chars: *mut jschar = cast::transmute(JS_malloc(cx, nchars as u64 * (size_of::<jschar>() as u64)));
|
||||
let chars: *mut jschar = cast::transmute(JS_malloc(cx, (nchars + 1) as u64 * (size_of::<jschar>() as u64)));
|
||||
if chars.is_null() {
|
||||
return ptr::null();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue