iliaa Wed Jan 21 15:45:45 2009 UTC
Modified files:
/php-src/ext/standard base64.c
Log:
MFB: 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.57&r2=1.58&diff_format=u
Index: php-src/ext/standard/base64.c
diff -u php-src/ext/standard/base64.c:1.57 php-src/ext/standard/base64.c:1.58
--- php-src/ext/standard/base64.c:1.57 Wed Dec 31 11:12:36 2008
+++ php-src/ext/standard/base64.c Wed Jan 21 15:45:45 2009
@@ -15,7 +15,7 @@
| Author: Jim Winstead <[email protected]> |
+----------------------------------------------------------------------+
*/
-/* $Id: base64.c,v 1.57 2008/12/31 11:12:36 sebastian Exp $ */
+/* $Id: base64.c,v 1.58 2009/01/21 15:45:45 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