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

Commit 5f46e657 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Android (Google) Code Review
Browse files

Merge "Make sure server response doesn't exceed maximum allowable length" into pi-dev

parents ea3fb897 14b5d86a
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -1645,7 +1645,13 @@ static void gattServerSendResponseNative(JNIEnv* env, jobject object,
  response.attr_value.len = 0;
  response.attr_value.len = 0;


  if (val != NULL) {
  if (val != NULL) {
    if (env->GetArrayLength(val) < BTGATT_MAX_ATTR_LEN) {
      response.attr_value.len = (uint16_t)env->GetArrayLength(val);
      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);
    jbyte* array = env->GetByteArrayElements(val, 0);


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