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

Commit d5e0f259 authored by Martin Brabham's avatar Martin Brabham
Browse files

Copy all 16 bytes of the IRK

Bug: 194432570
Test: Manual test app; nRF connect
Tag: #feature
Change-Id: Ibdb62b38dd0695e301348502071f7a2b6fa7cfae
parent 150dd7d4
Loading
Loading
Loading
Loading
+6 −11
Original line number Diff line number Diff line
@@ -1503,7 +1503,7 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,
  jfieldID dataMaskFid = env->GetFieldID(entryClazz, "data_mask", "[B");

  for (int i = 0; i < numFilters; ++i) {
    ApcfCommand curr;
    ApcfCommand curr{};

    ScopedLocalRef<jobject> current(env,
                                    env->GetObjectArrayElement(filters, i));
@@ -1518,12 +1518,6 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,

    curr.addr_type = env->GetByteField(current.get(), addrTypeFid);

    // Zero out Apcf IRK, maybe set later if one was passed
    int j;
    for (j = 0; j < 16; j++) {
      curr.irk[j] = 0;
    }

    ScopedLocalRef<jbyteArray> irkByteArray(
        env, (jbyteArray)env->GetObjectField(current.get(), irkTypeFid));

@@ -1535,10 +1529,11 @@ static void gattClientScanFilterAddNative(JNIEnv* env, jobject object,
        jniThrowIOException(env, EINVAL);
      }
      jbyte* irkBytes = env->GetByteArrayElements(irkByteArray.get(), NULL);
      if (irkBytes != NULL) {
        for (int j = 0; j < len; j++) {
          curr.irk[i] = irkBytes[i];
      if (irkBytes == NULL) {
        jniThrowIOException(env, EINVAL);
      }
      for (int j = 0; j < len; j++) {
        curr.irk[j] = irkBytes[j];
      }
    }