Skip to content

Commit

Permalink
Merge pull request #400 from pact-foundation/fix/lifetime
Browse files Browse the repository at this point in the history
fix: binary body lifetime issue
  • Loading branch information
rholshausen authored Mar 12, 2024
2 parents 72f8368 + fca0c4a commit 7fe434b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rust/pact_ffi/src/mock_server/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ fn convert_ptr_to_body(body: *const u8, size: size_t, content_type: Option<Conte
} else if size == 0 {
OptionalBody::Empty
} else {
OptionalBody::Present(Bytes::from(unsafe { std::slice::from_raw_parts(body, size) }), content_type, None)
OptionalBody::Present(Bytes::copy_from_slice(unsafe { std::slice::from_raw_parts(body, size) }), content_type, None)
}
}

Expand Down

0 comments on commit 7fe434b

Please sign in to comment.