cat-in-136 / cargo-generate-rpm

Cargo helper command to generate a binary RPM package
MIT License
92 stars 19 forks source link

Use raw pointer for `Dependency` to `u8` slice conversion #63

Closed orhun closed 1 year ago

orhun commented 1 year ago

std::mem::transmute_copy causes undefined behavior if the destination type and target type has different sizes. This PR eliminates this issue by using raw pointer to the data and converting it to a u8 slice with the given size.

More detailed explanation: https://stackoverflow.com/questions/25917260/getting-raw-bytes-from-packed-struct

Fixes #62