Changeset

601:6cb908ef01c8

Fixed util.encodings.base64.decode to not truncate results when encountering an '=' before the end of the given input.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 08 Dec 2008 03:19:11 +0500
parents 600:2255a2e84ddc
children 602:a977227aa9e6
files util-src/encodings.c
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/encodings.c	Sun Dec 07 19:18:50 2008 +0000
+++ b/util-src/encodings.c	Mon Dec 08 03:19:11 2008 +0500
@@ -90,7 +90,7 @@
 	luaL_buffinit(L,&b);
 	for (;;)
 	{
-		int c=*s++;
+		int c=*s++;
 		switch (c)
 		{
 			const char *p;
@@ -108,8 +108,10 @@
 				{
 					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;