mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 03:40:16 +02:00
irc-nicklist: initialize nickrec->hops when sscanf fails in fill_who
When fill_who() is called from event_whox_channel_full, the hops parameter may be an empty string if the server sent a malformed WHOX reply with fewer tokens than expected. sscanf() on an empty string returns 0 (no items matched), leaving nickrec->hops at its prior value rather than a clean default. Fix: check the sscanf return value and set hops to 0 if parsing failed.
This commit is contained in:
parent
43f1727ef9
commit
c02337a150
1 changed files with 2 additions and 1 deletions
|
|
@ -245,7 +245,8 @@ static void fill_who(SERVER_REC *server, const char *channel, const char *user,
|
|||
nicklist_set_account(chanrec, nickrec,
|
||||
strcmp(account, "0") == 0 ? "*" : account);
|
||||
}
|
||||
sscanf(hops, "%d", &nickrec->hops);
|
||||
if (sscanf(hops, "%d", &nickrec->hops) != 1)
|
||||
nickrec->hops = 0;
|
||||
}
|
||||
|
||||
nicklist_update_flags(server, nick,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue