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

Commit 20a9d871 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

GattServcer: Check invalid offset am: 1c12e817

Change-Id: I1d3aae196fb82155b88e2377e96670797f228f8a
parents a6f797d1 1c12e817
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include "service/gatt_server.h"

#include "osi/include/log.h"
#include "service/common/bluetooth/util/address_helper.h"
#include "service/logging_helpers.h"

@@ -126,6 +127,12 @@ bool GattServer::SendResponse(const std::string& device_address, int request_id,
    return false;
  }

  if (offset < 0) {
    android_errorWriteLog(0x534e4554, "143231677");
    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;