mirror of
https://github.com/irssi/irssi.git
synced 2026-08-08 19:30:15 +02:00
irc-nicklist: avoid reading past end of parsed token in event_userhost
When processing RPL_USERHOST (302), the code finds '=' in the host string, replaces it with NUL, advances ptr past it, and dereferences *ptr to check for '-'. If '=' is the last character in the string (e.g. 'nick=' sent by a malicious server), ptr advances to the NUL terminator. While this is still within the allocated buffer, it is defensively safer to guard the '-' check with a NUL check on *ptr first.
This commit is contained in:
parent
43f1727ef9
commit
c0787c5714
1 changed files with 1 additions and 1 deletions
|
|
@ -531,7 +531,7 @@ static void event_userhost(SERVER_REC *server, const char *data)
|
|||
oper = 0;
|
||||
*ptr++ = '\0';
|
||||
|
||||
nicklist_update_flags(server, *pos, *ptr == '-', oper);
|
||||
nicklist_update_flags(server, *pos, *ptr != '\0' && *ptr == '-', oper);
|
||||
}
|
||||
g_strfreev(phosts);
|
||||
g_free(params);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue