From e00e9a1defa2c6a3c7aa7c5b8c2186bc5e64f75c Mon Sep 17 00:00:00 2001 From: Jim Borden Date: Wed, 1 Jul 2026 14:58:53 +0900 Subject: [PATCH] CBL-8588: Bounds check the peer ID This was mistakenly passed as-is to JNI, but it is not always null terminated --- common/main/cpp/native_c4btsocketfactory.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/main/cpp/native_c4btsocketfactory.cc b/common/main/cpp/native_c4btsocketfactory.cc index 74efcdce9..1db773bf7 100644 --- a/common/main/cpp/native_c4btsocketfactory.cc +++ b/common/main/cpp/native_c4btsocketfactory.cc @@ -177,7 +177,7 @@ static void btAttached(C4Socket* socket) { return; } - jstring jPeerID = env->NewStringUTF((const char *)ctx->peerID.buf); + jstring jPeerID = toJString(env, ctx->peerID); // Balanced by the c4socket_release in NativeC4Socket_closed. Mirrors btOpen. c4socket_retain(socket);