From 87b359e44d9965fcaf61e75df6c5c48d5a892155 Mon Sep 17 00:00:00 2001 From: Almeida Date: Tue, 2 Dec 2025 23:13:10 +0000 Subject: [PATCH] fix: replace usages of `Buffer#slice()` with `Buffer#subarray()` (#11326) fix: replace usages of Buffer.slice() with Buffer.subarray() Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/voice/__tests__/VoiceReceiver.test.ts | 2 +- packages/voice/src/networking/VoiceUDPSocket.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/voice/__tests__/VoiceReceiver.test.ts b/packages/voice/__tests__/VoiceReceiver.test.ts index 7410ce2b2..b885fad30 100644 --- a/packages/voice/__tests__/VoiceReceiver.test.ts +++ b/packages/voice/__tests__/VoiceReceiver.test.ts @@ -157,7 +157,7 @@ describe('VoiceReceiver', () => { ); const expectedNonce = Buffer.concat([ - XCHACHA20_SAMPLE.encrypted.slice(XCHACHA20_SAMPLE.encrypted.length - 4), + XCHACHA20_SAMPLE.encrypted.subarray(XCHACHA20_SAMPLE.encrypted.length - 4), Buffer.alloc(20), ]); diff --git a/packages/voice/src/networking/VoiceUDPSocket.ts b/packages/voice/src/networking/VoiceUDPSocket.ts index 84bc40f17..e68de60b2 100644 --- a/packages/voice/src/networking/VoiceUDPSocket.ts +++ b/packages/voice/src/networking/VoiceUDPSocket.ts @@ -20,7 +20,7 @@ export interface SocketConfig { export function parseLocalPacket(message: Buffer): SocketConfig { const packet = Buffer.from(message); - const ip = packet.slice(8, packet.indexOf(0, 8)).toString('utf8'); + const ip = packet.subarray(8, packet.indexOf(0, 8)).toString('utf8'); if (!isIPv4(ip)) { throw new Error('Malformed IP address');