diff options
author | Sebastian Thorarensen <sebth@naju.se> | 2014-06-17 17:25:40 +0200 |
---|---|---|
committer | Sebastian Thorarensen <sebth@naju.se> | 2014-07-06 23:24:09 +0200 |
commit | 90f3dd612e0d7a6027e60018ca5476e7ddb52f54 (patch) | |
tree | 6eb512d110c8b284fb8a50efe1cd78cb4cdbb930 /src/irc | |
parent | 281c6d437dbc30ffc30c615b8dc773dc937abefa (diff) | |
download | irssi-90f3dd612e0d7a6027e60018ca5476e7ddb52f54.zip |
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
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/core/irc-servers.c | 6 |
1 files changed, 5 insertions, 1 deletions
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); |