From 1e9e834f6804b1265271b019a0d62db3a35a0cbd Mon Sep 17 00:00:00 2001 From: Mark Cavage Date: Tue, 6 Dec 2011 13:56:20 -0800 Subject: [PATCH] Control parsing incorrect if criticality field ommitted --- lib/control.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/control.js b/lib/control.js index a7c2688..778b847 100644 --- a/lib/control.js +++ b/lib/control.js @@ -63,8 +63,10 @@ Control.prototype.parse = function(ber) { if (ber.length) { this.type = ber.readString(); - if (ber.offset < end) - this.criticality = ber.readBoolean(); + if (ber.offset < end) { + if (ber.peek() === 0x01) // Boolean, optional + this.criticality = ber.readBoolean(); + } if (ber.offset < end) this.value = ber.readString();