Skip to content

Commit

Permalink
fixup! fix(coap-server): ignore incoming messages with an invalid sou…
Browse files Browse the repository at this point in the history
…rce port
  • Loading branch information
JKRhb committed Dec 11, 2023
1 parent ec3f067 commit a640d6c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/binding-coap/src/coap-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ export default class CoapServer implements ProtocolServer {
}

private async handleRequest(req: IncomingMessage, res: OutgoingMessage) {
if (req.rsinfo.port === 0) {
const sourcePort = req.rsinfo.port;
const hasInvalidPortRange = sourcePort < 1 || sourcePort > 65535;
if (hasInvalidPortRange) {
// Ignore requests with an invalid source port
// See https://github.com/eclipse-thingweb/node-wot/issues/1182
return;
Expand Down

0 comments on commit a640d6c

Please sign in to comment.