Skip to content

Commit 2ee240e

Browse files
committed
Fix low-risk uninitialized memory buffer issue
1 parent 0b57a26 commit 2ee240e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ Client.scrape = function (opts, cb) {
155155
})
156156

157157
opts.infoHash = Array.isArray(opts.infoHash)
158-
? opts.infoHash.map(function (infoHash) { return new Buffer(infoHash, 'hex') })
159-
: new Buffer(opts.infoHash, 'hex')
158+
? opts.infoHash.map(function (infoHash) {
159+
return new Buffer(String(infoHash), 'hex')
160+
})
161+
: new Buffer(String(opts.infoHash), 'hex')
160162
client.scrape({ infoHash: opts.infoHash })
161163
return client
162164
}

0 commit comments

Comments
 (0)