diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2009-01-25 18:27:12 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2009-01-25 18:27:12 +0000 |
commit | 4eb69eadc68982516abbb08d6728a308b741f822 (patch) | |
tree | 985d90a56ad47434e906fe580a5364f10da9d4ee /ext/standard | |
parent | f19f0cefa5001c7069ec7d2dee939b64d28c74bc (diff) | |
download | php-git-4eb69eadc68982516abbb08d6728a308b741f822.tar.gz |
Improved fix for bug #47174 & added a test
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/base64.c | 1 | ||||
-rw-r--r-- | ext/standard/tests/url/bug47174.phpt | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/ext/standard/base64.c b/ext/standard/base64.c index 9b835409d1..531be2276c 100644 --- a/ext/standard/base64.c +++ b/ext/standard/base64.c @@ -156,7 +156,6 @@ PHPAPI unsigned char *php_base64_decode_ex(const unsigned char *str, int length, efree(result); return NULL; } - i++; continue; } diff --git a/ext/standard/tests/url/bug47174.phpt b/ext/standard/tests/url/bug47174.phpt new file mode 100644 index 0000000000..6d08063253 --- /dev/null +++ b/ext/standard/tests/url/bug47174.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #47174 (base64_decode() interprets pad char in mid string as terminator) +--FILE-- +<?php +if (base64_decode("dGVzdA==") == base64_decode("dGVzdA==CRAP")) { + echo "Same octect data - Signature Valid\n"; +} else { + echo "Invalid Signature\n"; +} + +$in = base64_encode("foo") . '==' . base64_encode("bar"); +var_dump($in, base64_decode($in)); + +?> +--EXPECT-- +Invalid Signature +string(10) "Zm9v==YmFy" +string(6) "foobar" |