mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-19 19:15:08 +00:00
Check device messages assumptions at runtime
Do not assume the server behaves correctly (scrcpy should not require the device to be trusted).
This commit is contained in:
parent
d894e270a7
commit
295102a6d9
1 changed files with 11 additions and 1 deletions
|
@ -43,9 +43,19 @@ process_msg(struct sc_receiver *receiver, struct sc_device_msg *msg) {
|
|||
break;
|
||||
}
|
||||
case DEVICE_MSG_TYPE_ACK_CLIPBOARD:
|
||||
assert(receiver->acksync);
|
||||
LOGD("Ack device clipboard sequence=%" PRIu64_,
|
||||
msg->ack_clipboard.sequence);
|
||||
|
||||
// This is a programming error to receive this message if there is
|
||||
// no ACK synchronization mechanism
|
||||
assert(receiver->acksync);
|
||||
|
||||
// Also check at runtime (do not trust the server)
|
||||
if (!receiver->acksync) {
|
||||
LOGE("Received unexpected ack");
|
||||
return;
|
||||
}
|
||||
|
||||
sc_acksync_ack(receiver->acksync, msg->ack_clipboard.sequence);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue