diff --git a/lib/net/socks.js b/lib/net/socks.js index f1e02008..36873ed8 100644 --- a/lib/net/socks.js +++ b/lib/net/socks.js @@ -497,8 +497,12 @@ SOCKS.prototype.handleResolve = function handleResolve(data) { return; } - this.state = SOCKS.states.RESOLVE_DONE; + if (addr.type === 0x03) { + this.error('Bad address type for tor resolve.'); + return; + } + this.state = SOCKS.states.RESOLVE_DONE; this.destroy(); this.emit('resolve', [addr.host]); @@ -697,7 +701,11 @@ function parseAddr(data, offset) { throw new Error('Unknown SOCKS address type: ' + type + '.'); } - return { host: host, port: port }; + return { + type: type, + host: host, + port: port + }; } /*