1
0
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:
Lauri Kenttä
2016-05-25 20:53:47 +03:00
committed by Nikita Popov
parent 260c07db85
commit 6d17ee744f
2 changed files with 16 additions and 2 deletions
+3 -2
View File
@@ -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;
+13
View File
@@ -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)