From a109c54918733a8787f6ef71f9e148c10f553f2d Mon Sep 17 00:00:00 2001 From: messense Date: Sat, 22 Jan 2022 11:59:28 +0800 Subject: [PATCH] fix(napi): add missing nul byte to `noop` Fixes a global-buffer-overflow bug --- crates/napi/src/bindgen_runtime/module_register.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/napi/src/bindgen_runtime/module_register.rs b/crates/napi/src/bindgen_runtime/module_register.rs index 94a2903f..847e6376 100644 --- a/crates/napi/src/bindgen_runtime/module_register.rs +++ b/crates/napi/src/bindgen_runtime/module_register.rs @@ -334,7 +334,7 @@ pub(crate) unsafe extern "C" fn noop( sys::napi_throw_error( env, ptr::null_mut(), - CStr::from_bytes_with_nul_unchecked(b"Class contains no `constructor`, can not new it!") + CStr::from_bytes_with_nul_unchecked(b"Class contains no `constructor`, can not new it!\0") .as_ptr(), ); }