# HG changeset patch # User Mikael Berthe # Date 1120478154 -3600 # Node ID 627925d885de22d6ae55b61299e98511c23e6047 # Parent 0770da258c057e403f9e7e26f7f2027148901428 Limit the number of lines in multi-line messages diff -r 0770da258c05 -r 627925d885de mcabber/src/screen.c --- a/mcabber/src/screen.c Sun Jul 03 22:41:42 2005 +0100 +++ b/mcabber/src/screen.c Mon Jul 04 12:55:54 2005 +0100 @@ -1167,6 +1167,14 @@ scr_LogPrint("Please send this part now..."); return; } + if (num >= MULTILINE_MAX_LINE_NUMBER) { + // We don't allow too many lines; however the maximum is arbitrary + // (It should be < 1000 yet) + scr_LogPrint("Your message has too many lines, this one has " + "not been added."); + scr_LogPrint("Please send this part now..."); + return; + } multiline = g_renew(char, multiline, len); strcat(multiline, "\n"); strcat(multiline, line); diff -r 0770da258c05 -r 627925d885de mcabber/src/screen.h --- a/mcabber/src/screen.h Sun Jul 03 22:41:42 2005 +0100 +++ b/mcabber/src/screen.h Mon Jul 04 12:55:54 2005 +0100 @@ -16,6 +16,11 @@ #define INPUTLINE_LENGTH 1024 +// Only used in screen.c; this is the maximum line number +// in a multi-line message. Should be < 1000 +// Note: message length is limited by the HBB_BLOCKSIZE size too +#define MULTILINE_MAX_LINE_NUMBER 299 + extern int update_roster; void scr_InitCurses(void);