Merge "adbd: Fix check against valid payload size" am: 596f3b5384 am: 9a80494702 am: aeb5be6f45
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1428117 Change-Id: I8edbc03fa678a549cf037699b7ab2f6d953b4a44
This commit is contained in:
commit
74246334dd
1 changed files with 1 additions and 2 deletions
|
|
@ -584,12 +584,11 @@ struct UsbFfsConnection : public Connection {
|
||||||
incoming_header_ = msg;
|
incoming_header_ = msg;
|
||||||
} else {
|
} else {
|
||||||
size_t bytes_left = incoming_header_->data_length - incoming_payload_.size();
|
size_t bytes_left = incoming_header_->data_length - incoming_payload_.size();
|
||||||
Block payload = std::move(block->payload);
|
|
||||||
if (block->payload.size() > bytes_left) {
|
if (block->payload.size() > bytes_left) {
|
||||||
HandleError("received too many bytes while waiting for payload");
|
HandleError("received too many bytes while waiting for payload");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
incoming_payload_.append(std::move(payload));
|
incoming_payload_.append(std::move(block->payload));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (incoming_header_->data_length == incoming_payload_.size()) {
|
if (incoming_header_->data_length == incoming_payload_.size()) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue