aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2008-12-08 03:19:11 +0500
committerWaqas Hussain <waqas20@gmail.com>2008-12-08 03:19:11 +0500
commitf7596f63cf106662abc2936454e839ee20fb7dca (patch)
tree834cba68750249e1d7b805613feca15b99f5c671
parentf48883b6ab37867f687aa6279f43da6a56cd40f1 (diff)
downloadprosody-f7596f63cf106662abc2936454e839ee20fb7dca.tar.gz
prosody-f7596f63cf106662abc2936454e839ee20fb7dca.zip
Fixed util.encodings.base64.decode to not truncate results when encountering an '=' before the end of the given input.
-rw-r--r--util-src/encodings.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util-src/encodings.c b/util-src/encodings.c
index 48144204..6697fc2f 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -90,7 +90,7 @@ static int Lbase64_decode(lua_State *L) /** decode(s) */
luaL_buffinit(L,&b);
for (;;)
{
- int c=*s++;
+ int c=*s++;
switch (c)
{
const char *p;
@@ -108,8 +108,10 @@ static int Lbase64_decode(lua_State *L) /** decode(s) */
{
case 1: base64_decode(&b,t[0],0,0,0,1); break;
case 2: base64_decode(&b,t[0],t[1],0,0,2); break;
- case 3: base64_decode(&b,t[0],t[1],t[2],0,3); break;
- }
+ case 3: base64_decode(&b,t[0],t[1],t[2],0,3); break;
+ }
+ n=0;
+ break;
case 0:
luaL_pushresult(&b);
return 1;