From c1b1d82d109846ba58a4664dc5480c69ad2fc097 Mon Sep 17 00:00:00 2001 From: Paragon Initiative Enterprises Date: Mon, 13 Jun 2022 01:29:16 -0400 Subject: [PATCH] Off-by-one error --- src/Base32.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Base32.php b/src/Base32.php index 3ff4156..5054d73 100644 --- a/src/Base32.php +++ b/src/Base32.php @@ -197,7 +197,7 @@ public static function decodeNoPadding(string $encodedString, bool $upper = fals } if (($srcLen & 7) === 0) { for ($j = 0; $j < 7 && $j < $srcLen; ++$j) { - if ($encodedString[$srcLen - $j] === '=') { + if ($encodedString[$srcLen - $j - 1] === '=') { throw new InvalidArgumentException( "decodeNoPadding() doesn't tolerate padding" );