Fix low-risk uninitialized memory buffer issue

This commit is contained in:
Feross Aboukhadijeh 2016-05-25 13:49:19 -07:00
parent 0b57a26e42
commit 2ee240ea16

View File

@ -155,8 +155,10 @@ Client.scrape = function (opts, cb) {
})
opts.infoHash = Array.isArray(opts.infoHash)
? opts.infoHash.map(function (infoHash) { return new Buffer(infoHash, 'hex') })
: new Buffer(opts.infoHash, 'hex')
? opts.infoHash.map(function (infoHash) {
return new Buffer(String(infoHash), 'hex')
})
: new Buffer(String(opts.infoHash), 'hex')
client.scrape({ infoHash: opts.infoHash })
return client
}