Mercurial > pidgin
diff libpurple/protocols/yahoo/yahoo.c @ 24967:adf153852bcf
propagate from branch 'im.pidgin.pidgin' (head df86c6f1de324e87828356aa8d5c369abd533b58)
to branch 'im.pidgin.pidgin.vv' (head 5bf87e309f2fee61842cccf4992de4866349570c)
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Mon, 24 Nov 2008 10:59:08 +0000 |
parents | 4d752d07a126 9e0458c98b4c |
children | 25e2ab1fff1d |
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c Mon Nov 24 10:43:38 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Mon Nov 24 10:59:08 2008 +0000 @@ -3619,8 +3619,26 @@ PurpleWhiteboard *wb; int ret = 1; YahooFriend *f = NULL; + gsize lenb = 0; + glong lenc = 0; 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; + } + } yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); if ((f = yahoo_friend_find(gc, who)) && f->protocol)