1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00

MFB: Fixed bug #47174 (base64_decode() interprets pad char in mid string as

terminator)
This commit is contained in:
Ilia Alshanetsky
2009-01-21 15:45:29 +00:00
parent aa6595916b
commit 3a78a01817
2 changed files with 10 additions and 1 deletions
+2
View File
@@ -17,6 +17,8 @@ PHP NEWS
- Fixed bug in xml_error_string() which resulted in messages being
off by one. (Scott)
- Fixed bug #47174 (base64_decode() interprets pad char in mid string as
terminator). (Ilia)
- Fixed bug #47165 (Possible memory corruption when passing return value by
reference). (Dmitry)
- Fixed bug #47152 (gzseek/fseek using SEEK_END produces strange results).
+8 -1
View File
@@ -153,7 +153,14 @@ PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length,
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0' && length-- > 0) {
if (ch == base64_pad) break;
if (ch == base64_pad) {
if (*current != '=' && (i % 4) == 1) {
efree(result);
return NULL;
}
i++;
continue;
}
ch = base64_reverse_table[ch];
if ((!strict && ch < 0) || ch == -1) { /* a space or some other separator character, we simply skip over */