changeset 26161:90ffe6f71fa9

clearing conflicts while merging from im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Tue, 20 Jan 2009 17:11:35 +0000
parents 97c420d62381
children 0a19fa42f8ce
files libpurple/protocols/yahoo/yahoo.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Tue Jan 20 16:28:40 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Tue Jan 20 17:11:35 2009 +0000
@@ -4435,10 +4435,28 @@
 	PurpleWhiteboard *wb;
 	int ret = 1;
 	YahooFriend *f = NULL;
+	gsize lenb = 0;
+	glong lenc = 0;
 	struct yahoo_p2p_data *p2p_data;
 	gboolean wlm = FALSE;
 	msg2 = yahoo_string_encode(gc, msg, &utf8);
 
+	if(msg2) {
+		lenb = strlen(msg2);
+		lenc = g_utf8_strlen(msg2, -1);
+
+		if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) {
+			purple_debug_info("yahoo", "Message too big.  Length is %" G_GSIZE_FORMAT
+					" bytes, %ld characters.  Max is %d bytes, %d chars."
+					"  Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES,
+					YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2);
+			yahoo_packet_free(pkt);
+			g_free(msg);
+			g_free(msg2);
+			return -E2BIG;
+		}
+	}
+
 	wlm = g_str_has_prefix(who, "wlm/") || g_str_has_prefix(who, "WLM/");
 
 	if( strncmp(who, "+", 1) == 0 )	{