diff src/util.c @ 7265:d565594c1bae

[gaim-migrate @ 7842] fix the base64 encode function to allocate the right amount of memory. this fixes an issue logging into jabberd 2.0 servers, and probably a few other things committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Tue, 14 Oct 2003 21:17:20 +0000
parents 85fcaff1505d
children 3a41c3f80228
line wrap: on
line diff
--- a/src/util.c	Tue Oct 14 17:12:17 2003 +0000
+++ b/src/util.c	Tue Oct 14 21:17:20 2003 +0000
@@ -142,7 +142,7 @@
 	g_return_val_if_fail(in != NULL, NULL);
 	g_return_val_if_fail(inlen > 0,  NULL);
 
-	rv = out = g_malloc((4 * (inlen + 1)) / 3 + 1);
+	rv = out = g_malloc(((inlen/3)+1)*4 + 1);
 
 	for (; inlen >= 3; inlen -= 3)
 	{