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

Commit 7e16a1ac authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by android-build-merger
Browse files

Make sure server response doesn't exceed maximum allowable length am: 461fd829

am: acb7c0d8

Change-Id: Ie3c99a10ad3eee642917095488c2424f87ecee9d
parents 76c7aa42 acb7c0d8
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1650,7 +1650,13 @@ static void gattServerSendResponseNative(JNIEnv* env, jobject object,
  response.attr_value.len = 0;

  if (val != NULL) {
    if (env->GetArrayLength(val) < BTGATT_MAX_ATTR_LEN) {
      response.attr_value.len = (uint16_t)env->GetArrayLength(val);
    } else {
      android_errorWriteLog(0x534e4554, "78787521");
      response.attr_value.len = BTGATT_MAX_ATTR_LEN;
    }

    jbyte* array = env->GetByteArrayElements(val, 0);

    for (int i = 0; i != response.attr_value.len; ++i)