From f7596f63cf106662abc2936454e839ee20fb7dca Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Mon, 8 Dec 2008 03:19:11 +0500 Subject: Fixed util.encodings.base64.decode to not truncate results when encountering an '=' before the end of the given input. --- util-src/encodings.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util-src') 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; -- cgit v1.2.3