fix(parse-http): ignore announcements from peers with invalid announcement ports. (#513)

This commit is contained in:
Brad Marsden 2024-03-12 17:40:46 +00:00 committed by GitHub
parent ea1e78e1de
commit fe75272d51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,7 +22,7 @@ export default function (req, opts) {
params.peer_id = bin2hex(params.peer_id)
params.port = Number(params.port)
if (!params.port) throw new Error('invalid port')
if (!params.port || params.port <= 0 || params.port > 65535) throw new Error('invalid port')
params.left = Number(params.left)
if (Number.isNaN(params.left)) params.left = Infinity