1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Fix the userhostlen' fallback in split_message'

ferret, the author of `splitlong-safe.pl' pointed out that `userhostlen'
should not only contain the maximum length of the hostname, but also the
maximum length of the username. Now 10 is used as the maximum username
length as a fallback. (`splitlong-safe.pl' uses the same limit.)

The username limit isn't defined in the standard, but 10 is common on
many networks. The odds that something goes wrong here is low, as
 1) the fallback limit is only used when the user has not yet joined a
    channel
 2) the maximum hostname length (63) gives some error margin as the
    hostname usually is shorter
This commit is contained in:
Sebastian Thorarensen 2014-06-17 17:25:40 +02:00
parent 281c6d437d
commit 90f3dd612e

View File

@ -169,7 +169,11 @@ static char **split_message(SERVER_REC *server, const char *target,
const char *msg)
{
IRC_SERVER_REC *ircserver = IRC_SERVER(server);
int userhostlen = 63; /* Maximum length defined by protocol. */
/*
* 63 is the maxmium hostname length defined by the protocol. 10 is
* a common username limit on many networks. 1 is for the `@'.
*/
int userhostlen = 63 + 10 + 1;
g_return_val_if_fail(ircserver != NULL, NULL);
g_return_val_if_fail(target != NULL, NULL);