Mercurial > pidgin
changeset 5355:6a57fd9b45e1
[gaim-migrate @ 5731]
Limit how big the icons can be, file size-wise.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 11 May 2003 04:00:19 +0000 |
parents | 8a74fbcb7bcb |
children | 1333675218a4 |
files | src/protocols/msn/buddyicon.c |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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));