Skip to content

Commit

Permalink
Merge #1947
Browse files Browse the repository at this point in the history
1947: Include a NUL byte in the message returned by wasm_trap_message(). r=nlewycky a=nlewycky



Co-authored-by: Nick Lewycky <[email protected]>
  • Loading branch information
bors[bot] and nlewycky authored Dec 16, 2020
2 parents 416ebbc + 1e07207 commit bc0ba32
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/c-api/src/wasm_c_api/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ pub unsafe extern "C" fn wasm_trap_message(
out: &mut wasm_byte_vec_t,
) {
let message = trap.inner.message();
let byte_vec: wasm_byte_vec_t = message.into_bytes().into();
let mut byte_vec = message.into_bytes();
byte_vec.push(0); // append NUL
let byte_vec: wasm_byte_vec_t = byte_vec.into();

out.size = byte_vec.size;
out.data = byte_vec.data;
Expand Down

0 comments on commit bc0ba32

Please sign in to comment.