From 645300a54cce75e819039372ff7401f0dc482b4f Mon Sep 17 00:00:00 2001 From: eachcan Date: Wed, 6 Feb 2013 11:16:37 +0800 Subject: [PATCH] Update lib/composer.js fix bugs: when maxLength is 0 or -1, ignore it and do not compare with length --- lib/composer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/composer.js b/lib/composer.js index 80984e0..5c9e1ce 100644 --- a/lib/composer.js +++ b/lib/composer.js @@ -112,7 +112,7 @@ pro._readLength = function(data, offset, end) { length *= LEFT_SHIFT_BITS; // left shift only within 32 bits length += (b & 0x7f); - if(length > this.maxLength) { + if(this.maxLength > 0 && length > this.maxLength) { this.state = ST_ERROR; this.emit('length_limit', this, data, offset); return -1; @@ -173,4 +173,4 @@ var fillLength = function(buf, data, size) { buf.writeUInt8(b, offset); data >>>= 7; } -}; \ No newline at end of file +};