mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 08:03:30 +01:00
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>
This commit is contained in:
@@ -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),
|
||||
]);
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user