ASN1: handle malformed input better

This commit is contained in:
terrafrost 2015-06-07 09:59:13 -05:00
parent 1ecd006685
commit 11000a93b9

View File

@ -329,6 +329,10 @@ class File_ASN1
$current+= array('headerlength' => 2);
}
if ($length > strlen($encoded)) {
return false;
}
$content = $this->_string_shift($encoded, $length);
// at this point $length can be overwritten. it's only accurate for definite length things as is
@ -358,7 +362,7 @@ class File_ASN1
$newcontent = array();
$remainingLength = $length;
while ($remainingLength) {
while ($remainingLength > 0) {
$temp = $this->_decode_ber($content, $start);
$length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5