# HG changeset patch # User David Demelier # Date 1614158358 -3600 # Node ID 724ecacb5a171930d0f77b3f20106ed022e56758 # Parent 49a126e8aed009ed7fe7c7ec5167687e493404ce irccd: fix improper finding of commands diff -r 49a126e8aed0 -r 724ecacb5a17 irccd/peer.c --- a/irccd/peer.c Wed Feb 24 09:38:02 2021 +0100 +++ b/irccd/peer.c Wed Feb 24 10:19:18 2021 +0100 @@ -941,13 +941,18 @@ static int cmp_cmd(const char *key, const struct cmd *cmd) { - return strncmp(key, cmd->name, strlen(cmd->name)); + return strcmp(key, cmd->name); } static const struct cmd * find(const char *line) { - return bsearch(line, cmds, IRC_UTIL_SIZE(cmds), + char cmd[32] = {0}; + + /* Extract the initial part of the line. */ + sscanf(line, "%31s", cmd); + + return bsearch(cmd, cmds, IRC_UTIL_SIZE(cmds), sizeof (cmds[0]), (irc_cmp)cmp_cmd); }