From 90f3dd612e0d7a6027e60018ca5476e7ddb52f54 Mon Sep 17 00:00:00 2001 From: Sebastian Thorarensen Date: Tue, 17 Jun 2014 17:25:40 +0200 Subject: [PATCH] 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 --- src/irc/core/irc-servers.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index fa7feda6..872dbbfd 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -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);