summaryrefslogtreecommitdiff
path: root/ext/standard/base64.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/base64.c')
-rw-r--r--ext/standard/base64.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
index 7cd108b36..bee528ad1 100644
--- a/ext/standard/base64.c
+++ b/ext/standard/base64.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2011 The PHP Group |
+ | Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -15,7 +15,7 @@
| Author: Jim Winstead <jimw@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: base64.c 306939 2011-01-01 02:19:59Z felipe $ */
+/* $Id: base64.c 321634 2012-01-01 13:15:04Z felipe $ */
#include <string.h>
@@ -153,6 +153,14 @@ PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length,
while ((ch = *current++) != '\0' && length-- > 0) {
if (ch == base64_pad) {
if (*current != '=' && ((i % 4) == 1 || (strict && length > 0))) {
+ if ((i % 4) != 1) {
+ while (isspace(*(++current))) {
+ continue;
+ }
+ if (*current == '\0') {
+ continue;
+ }
+ }
efree(result);
return NULL;
}