socks: more checks for tor resolve.

This commit is contained in:
Christopher Jeffrey 2017-01-25 13:57:42 -08:00
parent 2552b3fca3
commit e05fb77d33
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -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
};
}
/*