trim null bytes from octal nums

This commit is contained in:
Mathias Buus 2015-04-18 11:55:18 -07:00
parent 05d3af9d1b
commit 7c57165ad2

View file

@ -92,8 +92,10 @@ var encodeOct = function(val, n) {
var decodeOct = function(val, offset) { var decodeOct = function(val, offset) {
// Older versions of tar can prefix with spaces // Older versions of tar can prefix with spaces
while (offset < val.length && val[offset] === 32) offset++ while (offset < val.length && val[offset] === 32) offset++
var end = clamp(indexOf(val, 32, offset, val.length), val.length, val.length)
return parseInt(val.slice(offset, clamp(indexOf(val, 32, offset, val.length), val.length, val.length)).toString(), 8) while (offset < end && val[offset] === 0) offset++
if (end === offset) return 0
return parseInt(val.slice(offset, end).toString(), 8)
} }
var decodeStr = function(val, offset, length) { var decodeStr = function(val, offset, length) {