From 70c0a0ddf4311464eedef0011ed7b1f971a68de4 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 26 May 2019 03:18:06 -0500 Subject: [PATCH] ASN1: correctly handle long tags --- phpseclib/File/ASN1.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/File/ASN1.php b/phpseclib/File/ASN1.php index d76306f9..abab574a 100644 --- a/phpseclib/File/ASN1.php +++ b/phpseclib/File/ASN1.php @@ -326,9 +326,10 @@ class File_ASN1 $tag = 0; // process septets (since the eighth bit is ignored, it's not an octet) do { - $loop = ord($encoded[0]) >> 7; + $temp = ord($encoded[$encoded_pos++]); + $loop = $temp >> 7; $tag <<= 7; - $tag |= ord($encoded[$encoded_pos++]) & 0x7F; + $tag |= $temp & 0x7F; $start++; } while ($loop); }