# HG changeset patch # User Christian Hammond # Date 1052625619 0 # Node ID 6a57fd9b45e1c0040a9762dd8a350c2301b87788 # Parent 8a74fbcb7bcbe1883093e387a1613b6e4280bede [gaim-migrate @ 5731] Limit how big the icons can be, file size-wise. committer: Tailor Script diff -r 8a74fbcb7bcb -r 6a57fd9b45e1 src/protocols/msn/buddyicon.c --- a/src/protocols/msn/buddyicon.c Sun May 11 03:53:33 2003 +0000 +++ b/src/protocols/msn/buddyicon.c Sun May 11 04:00:19 2003 +0000 @@ -24,6 +24,8 @@ #define PACKET_LENGTH 1500 +#define MAX_BUDDY_ICON_FILE_SIZE 8192 + static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" "0123456789+/"; @@ -242,6 +244,13 @@ return TRUE; } + if (atoi(size_s) > MAX_BUDDY_ICON_FILE_SIZE) { + gaim_debug(GAIM_DEBUG_ERROR, "msn", + "User tried to send a buddy icon over 8KB! " + "Not accepting."); + return TRUE; + } + user = msn_message_get_sender(msg); passport = msn_user_get_passport(user); @@ -483,6 +492,13 @@ return; } + if (file_size > MAX_BUDDY_ICON_FILE_SIZE) { + gaim_debug(GAIM_DEBUG_ERROR, "msn", + "The buddy icon is too large to send. Must be no more " + "than %d bytes!\n", MAX_BUDDY_ICON_FILE_SIZE); + return; + } + msg = msn_message_new(); msn_message_set_content_type(msg, "application/x-buddyicon"); msn_message_set_receiver(msg, msn_message_get_sender(msg));