Skip to content

Commit 2c41956

Browse files
committed
fix: replace usages of Buffer.slice() with Buffer.subarray()
1 parent a022b24 commit 2c41956

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/voice/__tests__/VoiceReceiver.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ describe('VoiceReceiver', () => {
143143
);
144144

145145
const expectedNonce = Buffer.concat([
146-
XCHACHA20_SAMPLE.encrypted.slice(XCHACHA20_SAMPLE.encrypted.length - 4),
146+
XCHACHA20_SAMPLE.encrypted.subarray(XCHACHA20_SAMPLE.encrypted.length - 4),
147147
Buffer.alloc(20),
148148
]);
149149

packages/voice/src/networking/VoiceUDPSocket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface SocketConfig {
2020
export function parseLocalPacket(message: Buffer): SocketConfig {
2121
const packet = Buffer.from(message);
2222

23-
const ip = packet.slice(8, packet.indexOf(0, 8)).toString('utf8');
23+
const ip = packet.subarray(8, packet.indexOf(0, 8)).toString('utf8');
2424

2525
if (!isIPv4(ip)) {
2626
throw new Error('Malformed IP address');

0 commit comments

Comments
 (0)