diff options
author | Thies C. Arntzen <thies@php.net> | 2000-02-10 09:44:22 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 2000-02-10 09:44:22 +0000 |
commit | c59c663619346c2e9194cc8bd57e8b3e6371383d (patch) | |
tree | f9ab1359c3d77cd9b9f3b6b7efc8834a41f08899 /ext/standard/base64.c | |
parent | c8b321c6786a4d06c35f132a77ea2d616bab608a (diff) | |
download | php-git-c59c663619346c2e9194cc8bd57e8b3e6371383d.tar.gz |
@- base64_decode() will decode POST data correct. (Thies)
@ Patch submitted by: Turadg Aleahmad <turadg@wise.berkeley.edu>
Diffstat (limited to 'ext/standard/base64.c')
-rw-r--r-- | ext/standard/base64.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/ext/standard/base64.c b/ext/standard/base64.c index cce691f0bf..d3ddbd17ff 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -96,6 +96,16 @@ unsigned char *php_base64_decode(const unsigned char *str, int length, int *ret_ /* 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; |