mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
fix(imex): dc_decrypt_setup_file: extend lifetime of CString
payload_c binding makes sure the memory is not freed until strdup exits. See as_ptr documentation: https://doc.rust-lang.org/std/ffi/struct.CString.html#method.as_ptr
This commit is contained in:
committed by
Friedel Ziegelmayer
parent
5a8b4748b8
commit
0132106c7e
@@ -490,7 +490,8 @@ pub unsafe fn dc_decrypt_setup_file(
|
|||||||
if let Some(plain) =
|
if let Some(plain) =
|
||||||
dc_pgp_symm_decrypt(passphrase, binary as *const libc::c_void, binary_bytes)
|
dc_pgp_symm_decrypt(passphrase, binary as *const libc::c_void, binary_bytes)
|
||||||
{
|
{
|
||||||
payload = strdup(CString::new(plain).unwrap().as_ptr());
|
let payload_c = CString::new(plain).unwrap();
|
||||||
|
payload = strdup(payload_c.as_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user