diff options
author | seb <sebastian.messier@gmail.com> | 2024-08-20 14:25:41 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 21:25:41 +0000 |
commit | a3a54bc747abe8ca4cd7b0bdbb3e5276a062e914 (patch) | |
tree | b19daffbd66872fd00ce54e7a87da6c02d34e3a8 /ext/net/02_tls.js | |
parent | 37279e0b0a4300318da472bf0a8bdb894746537f (diff) |
fix(ext/net): validate port in Deno.{connect,serve,listen} (#24399)
Co-authored-by: Will Leach <4619280+melbourne2991@users.noreply.github.com>
Co-authored-by: Luca Casonato <hello@lcas.dev>
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'ext/net/02_tls.js')
-rw-r--r-- | ext/net/02_tls.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js index 81bcfb3bd..f6197e159 100644 --- a/ext/net/02_tls.js +++ b/ext/net/02_tls.js @@ -17,13 +17,12 @@ import { op_tls_start, } from "ext:core/ops"; const { - Number, ObjectDefineProperty, TypeError, SymbolFor, } = primordials; -import { Conn, Listener } from "ext:deno_net/01_net.js"; +import { Conn, Listener, validatePort } from "ext:deno_net/01_net.js"; class TlsConn extends Conn { #rid = 0; @@ -259,6 +258,7 @@ function listenTls({ if (transport !== "tcp") { throw new TypeError(`Unsupported transport: '${transport}'`); } + port = validatePort(port); if (!hasTlsKeyPairOptions(arguments[0])) { throw new TypeError( @@ -267,7 +267,7 @@ function listenTls({ } const keyPair = loadTlsKeyPair("Deno.listenTls", arguments[0]); const { 0: rid, 1: localAddr } = op_net_listen_tls( - { hostname, port: Number(port) }, + { hostname, port }, { alpnProtocols, reusePort }, keyPair, ); |