Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e9e1463 authored by Hansong Zhang's avatar Hansong Zhang Committed by Myles Watson
Browse files

GattServer: Check invalid offset

Test: manual
Bug: 143231677
Change-Id: I0ca22e7c60292d61c758120c1cd67f6e6edd8ae8
parent a6a1df65
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ bool GattServer::SendResponse(const std::string& device_address, int request_id,
    return false;
  }

  if (offset < 0) {
    LOG(ERROR) << "Offset is less than 0 offset: " << offset;
    return false;
  }

  if (value.size() + offset > BTGATT_MAX_ATTR_LEN) {
    LOG(ERROR) << "Value is too large";
    return false;