Skip to content

Conversation

@alxhotel
Copy link
Member

@alxhotel alxhotel commented Mar 1, 2016

If a client doesn't send the key info_hash (or sends it empty) in the request, then parseWebSocketRequest throws an Error.

Therefore, the key info_hash should not be used in the catch block, otherwise it will throw a TypeError while creating a new Buffer:

buffer.js:188
        throw new TypeError('First argument needs to be a number, ' +
              ^
TypeError: First argument needs to be a number, array or string.
    at new Buffer (buffer.js:188:15)
    at Object.exports.hexToBinary (/tracker2/node_modules/bittorrent-tracker/lib/common.js:15:10)
    at Server._onWebSocketRequest (/tracker2/node_modules/bittorrent-tracker/server.js:316:25)
    at WebSocket.EventEmitter.emit (events.js:98:17)
    at Receiver.ontext (/tracker2/node_modules/bittorrent-tracker/node_modules/ws/lib/WebSocket.js:816:10)
    at /tracker2/node_modules/bittorrent-tracker/node_modules/ws/lib/Receiver.js:477:18
    at /tracker2/node_modules/bittorrent-tracker/node_modules/ws/lib/Receiver.js:361:7
    at /tracker2/node_modules/bittorrent-tracker/node_modules/ws/lib/PerMessageDeflate.js:247:5
    at afterWrite (_stream_writable.js:274:3)
    at onwrite (_stream_writable.js:266:7)

feross added a commit that referenced this pull request Mar 2, 2016
Remove info_hash from failure reason
@feross feross merged commit caa6d45 into webtorrent:master Mar 2, 2016
@feross
Copy link
Member

feross commented Mar 2, 2016

Good catch – thank you!

@feross
Copy link
Member

feross commented Mar 2, 2016

Released as 7.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants