aboutsummaryrefslogtreecommitdiff
path: root/lib/git.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-03 12:16:56 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-06-03 12:36:49 -1000
commit81e06ce58a3a4a09b7c6c2837e8076ecec6e38e3 (patch)
treedfb54627171c2375d8fb0a49b4457586f3834cbd /lib/git.js
parent2aa94754c9a09e5ea707a30c6e937b7bfb3dd05a (diff)
downloadpatchfoo-81e06ce58a3a4a09b7c6c2837e8076ecec6e38e3.tar.gz
patchfoo-81e06ce58a3a4a09b7c6c2837e8076ecec6e38e3.zip
Protect against too much recursion
Diffstat (limited to 'lib/git.js')
-rw-r--r--lib/git.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/git.js b/lib/git.js
index 1360a6f..d4a071e 100644
--- a/lib/git.js
+++ b/lib/git.js
@@ -7,6 +7,7 @@ var packidx = require('pull-git-packidx-parser')
var Reader = require('pull-reader')
var toPull = require('stream-to-pull-stream')
var zlib = require('zlib')
+var looper = require('looper')
var ObjectNotFoundError = u.customError('ObjectNotFoundError')
@@ -501,12 +502,16 @@ Git.prototype.getTag = function (obj, cb) {
function readCString(reader, cb) {
var chars = []
- reader.read(1, function next(err, ch) {
+ var loop = looper(function () {
+ reader.read(1, next)
+ })
+ function next(err, ch) {
if (err) return cb(err)
if (ch[0] === 0) return cb(null, Buffer.concat(chars).toString('utf8'))
chars.push(ch)
- reader.read(1, next)
- })
+ loop()
+ }
+ loop()
}
Git.prototype.readTree = function (obj) {