Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 974d695d829619fe209b60d72193a250 > files > 3

evolution-data-server-1.12.2-1.2mdv2008.0.src.rpm

--- camel/camel-mime-utils.c.orig	2009-03-03 11:54:16.000000000 +0100
+++ camel/camel-mime-utils.c	2009-03-03 11:55:46.000000000 +0100
@@ -356,7 +356,11 @@ camel_base64_encode_simple (const char *
 	int state = 0, outlen;
 	unsigned int save = 0;
 	
-	out = g_malloc (len * 4 / 3 + 5);
+	if (len >= ((G_MAXSIZE - 1) / 4 - 1) * 3)
+		g_error("%s: input too large for Base64 encoding (%"G_GSIZE_FORMAT" chars)",
+			G_STRLOC, len);
+
+	out = g_malloc ((len / 3 + 1) * 4 + 1);
 	outlen = camel_base64_encode_close ((unsigned char *)data, len, FALSE,
 				      out, &state, &save);
 	out[outlen] = '\0';