1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

irc: add extra check on argument "nick" in functions "irc_nick_set_*"

This commit is contained in:
Sébastien Helleu
2019-05-14 07:26:48 +02:00
parent f6d6f7bac5
commit 34adcde2ff
+12
View File
@@ -125,6 +125,9 @@ irc_nick_set_current_prefix (struct t_irc_nick *nick)
{
char *ptr_prefixes;
if (!nick)
return;
nick->prefix[0] = ' ';
for (ptr_prefixes = nick->prefixes; ptr_prefixes[0]; ptr_prefixes++)
{
@@ -149,6 +152,9 @@ irc_nick_set_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
{
int index;
if (!nick)
return;
index = irc_server_get_prefix_char_index (server, prefix);
if (index >= 0)
{
@@ -167,6 +173,9 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
{
const char *ptr_prefixes;
if (!nick)
return;
/* reset all prefixes in nick */
memset (nick->prefixes, ' ', strlen (nick->prefixes));
@@ -190,6 +199,9 @@ irc_nick_set_prefixes (struct t_irc_server *server, struct t_irc_nick *nick,
void
irc_nick_set_host (struct t_irc_nick *nick, const char *host)
{
if (!nick)
return;
/* if host is the same, just return */
if ((!nick->host && !host)
|| (nick->host && host && strcmp (nick->host, host) == 0))