From f037d29abe1ebdfcb8b57528c1fa39d62197e8e6 Mon Sep 17 00:00:00 2001 From: Voltrex Date: Fri, 13 Aug 2021 03:20:51 +0430 Subject: [PATCH] dgram: use simplified validator The `dgram` lib module should use the simplified `validatePort()` validator. PR-URL: https://github.com/nodejs/node/pull/39753 Reviewed-By: James M Snell Reviewed-By: Antoine du Hamel Reviewed-By: Zijian Liu --- lib/dgram.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dgram.js b/lib/dgram.js index 4630be4dff8..c515c551427 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -369,7 +369,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) { }; Socket.prototype.connect = function(port, address, callback) { - port = validatePort(port, 'Port', { allowZero: false }); + port = validatePort(port, 'Port', false); if (typeof address === 'function') { callback = address; address = ''; @@ -626,7 +626,7 @@ Socket.prototype.send = function(buffer, } if (!connected) - port = validatePort(port, 'Port', { allowZero: false }); + port = validatePort(port, 'Port', false); // Normalize callback so it's either a function or undefined but not anything // else.