mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Fix potential use-after-free in dc_jsonrpc_request()
This commit is contained in:
@@ -4653,8 +4653,12 @@ mod jsonrpc {
|
||||
return;
|
||||
}
|
||||
|
||||
let api = &*jsonrpc_instance;
|
||||
let handle = &api.handle;
|
||||
let handle = &(*jsonrpc_instance).handle;
|
||||
|
||||
// Clone the handle so we do not use the reference
|
||||
// in spawned task after return from dc_jsonrpc_request().
|
||||
let handle = handle.clone();
|
||||
|
||||
let request = to_string_lossy(request);
|
||||
spawn(async move {
|
||||
handle.handle_incoming(&request).await;
|
||||
|
||||
Reference in New Issue
Block a user