Update php_base64_decode() to cover Bug52327

Strict mode should fail on padding characters mid-stream.
Esse commit está contido em:
Sara Golemon
2013-07-11 11:46:03 -07:00
commit ca02e9e482
3 arquivos alterados com 9 adições e 1 exclusões
+9 -1
Ver Arquivo
@@ -1884,7 +1884,15 @@ static unsigned char *php_base64_decode(const unsigned char *str,
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0' && length-- > 0) {
if (ch == base64_pad) {
if (*current != '=' && (i % 4) == 1) {
if (*current != '=' && ((i % 4) == 1 || (strict && length > 0))) {
if ((i % 4) != 1) {
while (isspace(*(++current))) {
continue;
}
if (*current == '\0') {
continue;
}
}
free(result);
return nullptr;
}