Skip to content

Commit

Permalink
cairo-lang-macro fix null-byte panics
Browse files Browse the repository at this point in the history
commit-id:e5393b42
  • Loading branch information
Draggu committed Nov 4, 2024
1 parent 702ddcf commit b07cfb1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugins/cairo-lang-macro/src/types/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ impl TokenStream {
///
/// # Safety
#[doc(hidden)]
pub fn into_stable(self) -> StableTokenStream {
pub fn into_stable(mut self) -> StableTokenStream {
// Remove 0 bytes so conversion will always work.
self.value.retain(|c| c != '\0');
let cstr = CString::new(self.value).unwrap();
StableTokenStream {
value: cstr.into_raw(),
Expand Down

0 comments on commit b07cfb1

Please sign in to comment.