From d6d7fee80f14ba89a051fefaa5d92bd4ff473273 Mon Sep 17 00:00:00 2001 From: Michael Morrison Date: Sun, 2 Feb 2014 11:10:25 -0600 Subject: [PATCH] Ensure that created buffers aren't doing any charset conversion --- games/ffow.js | 2 +- games/protocols/battlefield.js | 2 +- games/protocols/valve.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/games/ffow.js b/games/ffow.js index eced02c..f8536e1 100644 --- a/games/ffow.js +++ b/games/ffow.js @@ -8,7 +8,7 @@ module.exports = require('./protocols/valve').extend({ }, queryInfo: function(state,c) { var self = this; - self.sendPacket(0x46,false,new Buffer('LSQ'),0x49,function(b) { + self.sendPacket(0x46,false,'LSQ',0x49,function(b) { var reader = self.reader(b); state.raw.protocol = reader.uint(1); diff --git a/games/protocols/battlefield.js b/games/protocols/battlefield.js index bf4dfc4..995c8de 100644 --- a/games/protocols/battlefield.js +++ b/games/protocols/battlefield.js @@ -5,7 +5,7 @@ function buildPacket(params) { var paramBuffers = []; params.forEach(function(param) { - paramBuffers.push(new Buffer(param)); + paramBuffers.push(new Buffer(param,'utf8')); }); var totalLength = 12; diff --git a/games/protocols/valve.js b/games/protocols/valve.js index 24b1330..881a0ae 100644 --- a/games/protocols/valve.js +++ b/games/protocols/valve.js @@ -174,7 +174,7 @@ module.exports = require('./core').extend({ sendPacket: function(type,sendChallenge,payload,expect,callback,ontimeout) { var self = this; - if(typeof payload == 'string') payload = new Buffer(payload); + if(typeof payload == 'string') payload = new Buffer(payload,'binary'); var challengeLength = sendChallenge !== false ? 4 : 0; var payloadLength = payload ? payload.length : 0;