mirror of
https://github.com/php/php-src.git
synced 2026-04-26 01:18:19 +02:00
base64_decode: fix bug #72263 (skips char after padding)
This commit is contained in:
committed by
Nikita Popov
parent
260c07db85
commit
6d17ee744f
@@ -157,8 +157,9 @@ PHPAPI zend_string *php_base64_decode_ex(const unsigned char *str, size_t length
|
||||
return NULL;
|
||||
}
|
||||
if (length > 0 && *current != '=' && strict) {
|
||||
while (--length > 0 && isspace(*++current)) {
|
||||
continue;
|
||||
while (length > 0 && isspace(*current)) {
|
||||
current++;
|
||||
length--;
|
||||
}
|
||||
if (length == 0 || *current == '\0') {
|
||||
continue;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--TEST--
|
||||
Bug #72263 (base64_decode skips a character after padding in strict mode)
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(base64_decode("*", true));
|
||||
var_dump(base64_decode("=*", true));
|
||||
var_dump(base64_decode("VVV=", true));
|
||||
var_dump(base64_decode("VVV=*", true));
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
bool(false)
|
||||
string(2) "UU"
|
||||
bool(false)
|
||||
Reference in New Issue
Block a user