Skip to content

Commit

Permalink
Off-by-one error
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Jun 13, 2022
1 parent 4e88c9a commit c1b1d82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Base32.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
Expand Down

0 comments on commit c1b1d82

Please sign in to comment.