From: Pekka Riikonen Date: Mon, 28 May 2007 20:18:59 +0000 (+0000) Subject: Fixed nickname formatting crash when normalized nick is NULL X-Git-Tag: silc.toolkit.1.1~6 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=6c051d97ee2bbe7a7a9d761a1073a4bf67d307a3 Fixed nickname formatting crash when normalized nick is NULL (happens after JOIN notify and its following WHOIS). --- diff --git a/CHANGES b/CHANGES index 914b012c..cda01761 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,7 @@ -Mon May 28 21:21:39 EEST 2007 Pekka Riikonen +Mon May 28 23:21:39 EEST 2007 Pekka Riikonen + + * Fixed nickname formatting crash when updating existing + client entry. Affected file is lib/silcclient/client_entry.c. * Fixed MIME object encoding in attribute payload encoding. Affected file is lib/silccore/silcattrs.c. diff --git a/lib/silcclient/client_entry.c b/lib/silcclient/client_entry.c index a6dc88d5..a97adecd 100644 --- a/lib/silcclient/client_entry.c +++ b/lib/silcclient/client_entry.c @@ -1125,7 +1125,8 @@ SilcClientEntry silc_client_nickname_format(SilcClient client, } /* Is the requested client formatted already */ - if (!silc_utf8_strcasecmp(client_entry->nickname, + if (client_entry->nickname_normalized && + !silc_utf8_strcasecmp(client_entry->nickname, client_entry->nickname_normalized)) formatted = TRUE; @@ -1142,7 +1143,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client, unformatted = entry; break; } - } + } /* If there are no other unformatted clients and the requested client is unformatted, just return it. */ @@ -1151,7 +1152,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client, return client_entry; } - /* If priority formatting then the requested client will get the + /* If priority formatting then the requested client will get the unformatted nickname, and the unformatted client will get a new formatted nickname. */ if (priority) { @@ -1161,7 +1162,7 @@ SilcClientEntry silc_client_nickname_format(SilcClient client, &cp)) return NULL; - silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname), + silc_snprintf(client_entry->nickname, sizeof(client_entry->nickname), cp); silc_free(cp); }