net: validate non-string host for socket.connect

Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/57198
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Daeyeon Jeong 2025-03-11 23:48:27 +09:00 committed by RafaelGSS
parent 38989b070a
commit e56ca1a3f2
No known key found for this signature in database
GPG key ID: 8BEAB4DFCF555EF4
2 changed files with 14 additions and 0 deletions

View file

@ -1311,6 +1311,8 @@ function lookupAndConnect(self, options) {
const host = options.host || 'localhost';
let { port, autoSelectFamilyAttemptTimeout, autoSelectFamily } = options;
validateString(host, 'options.host');
if (localAddress && !isIP(localAddress)) {
throw new ERR_INVALID_IP_ADDRESS(localAddress);
}