fix: dns lookup fail with IP with zeros padding (#237)

This commit is contained in:
Ricardas Jonaitis
2021-01-04 17:34:40 +02:00
committed by GitHub
parent 78de22f518
commit bffcc35299

View File

@@ -9,7 +9,7 @@ module.exports = {
const rawConnection = _.get(command, 'arg', '').split(',');
if (rawConnection.length !== 6) return this.reply(425);
const ip = rawConnection.slice(0, 4).join('.');
const ip = rawConnection.slice(0, 4).map((b) => parseInt(b)).join('.');
const portBytes = rawConnection.slice(4).map((p) => parseInt(p));
const port = portBytes[0] * 256 + portBytes[1];