cvs: /php4/ext/standard base64.c
| From: | Thies C. Arntzen | Date: | Thu, 10 Feb 2000 09:44:52 +0000 |
| Subject: | cvs: /php4/ext/standard base64.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-10012@lists.php.net to get a copy of this message | ||
thies Thu Feb 10 01:44:52 2000 EDT
Modified files:
/php4/ext/standard base64.c
Log:
@- base64_decode() will decode POST data correct. (Thies)
@ Patch submitted by: Turadg Aleahmad <turadg@wise.berkeley.edu>
Index: php4/ext/standard/base64.c
diff -u php4/ext/standard/base64.c:1.15 php4/ext/standard/base64.c:1.16
--- php4/ext/standard/base64.c:1.15 Tue Feb 8 14:21:43 2000
+++ php4/ext/standard/base64.c Thu Feb 10 01:44:22 2000
@@ -15,7 +15,7 @@
| Author: Jim Winstead (jimw@php.net) |
+----------------------------------------------------------------------+
*/
-/* $Id: base64.c,v 1.15 2000/02/08 22:21:43 zeev Exp $ */
+/* $Id: base64.c,v 1.16 2000/02/10 09:44:22 thies Exp $ */
#include <string.h>
@@ -96,6 +96,16 @@
/* run through the whole string, converting as we go */
while ((ch = *current++) != '\0') {
if (ch == base64_pad) break;
+
+ /* When Base64 gets POSTed, all pluses are interpreted as spaces.
+ This line changes them back. It's not exactly the Base64 spec,
+ but it is completely compatible with it (the spec says that
+ spaces are invalid). This will also save many people considerable
+ headache. - Turadg Aleahmad <turadg@wise.berkeley.edu>
+ */
+
+ if (ch == ' ') ch = '+';
+
ch = reverse_table[ch];
if (ch < 0) continue;