Skip to content

Commit

Permalink
fix(parse-http): ignore announcements from peers with invalid announc…
Browse files Browse the repository at this point in the history
…ement ports. (#513)
  • Loading branch information
SilentBot1 committed Mar 12, 2024
1 parent ea1e78e commit fe75272
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/server/parse-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe75272

Please sign in to comment.