Skip to content

Commit 99208c8

Browse files
authored
Fix use-after-free in json_validator sample (#3668)
1 parent b905053 commit 99208c8

File tree

1 file changed

+1
-1
lines changed
  • crates/samples/components/json_validator/src

1 file changed

+1
-1
lines changed

crates/samples/components/json_validator/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ fn sanitized_value() {
315315
)
316316
);
317317
let sanitized = std::slice::from_raw_parts(sanitized_alloc, sanitized_len);
318-
let sanitized = String::from_utf8_lossy(sanitized);
318+
let sanitized = String::from_utf8_lossy(sanitized).into_owned();
319319
CoTaskMemFree(Some(sanitized_alloc as _));
320320
assert_eq!(sanitized, r#"{"age":21,"name":"Kenny"}"#);
321321

0 commit comments

Comments
 (0)