iliaa Wed Jan 21 15:38:38 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/standard base64.c
Log:
Fixed bug #47174 (base64_decode() interprets pad char in mid string as
terminator)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/base64.c?r1=1.43.2.2.2.3.2.4&r2=1.43.2.2.2.3.2.5&diff_format=u
Index: php-src/ext/standard/base64.c
diff -u php-src/ext/standard/base64.c:1.43.2.2.2.3.2.4
php-src/ext/standard/base64.c:1.43.2.2.2.3.2.5
--- php-src/ext/standard/base64.c:1.43.2.2.2.3.2.4 Wed Dec 31 11:15:44 2008
+++ php-src/ext/standard/base64.c Wed Jan 21 15:38:37 2009
@@ -15,7 +15,7 @@
| Author: Jim Winstead <[email protected]> |
+----------------------------------------------------------------------+
*/
-/* $Id: base64.c,v 1.43.2.2.2.3.2.4 2008/12/31 11:15:44 sebastian Exp $ */
+/* $Id: base64.c,v 1.43.2.2.2.3.2.5 2009/01/21 15:38:37 iliaa Exp $ */
#include <string.h>
@@ -151,7 +151,14 @@
/* 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 */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php