Fixed nickname formatting crash when normalized nick is NULL
authorPekka Riikonen <priikone@silcnet.org>
Mon, 28 May 2007 20:18:59 +0000 (20:18 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 28 May 2007 20:18:59 +0000 (20:18 +0000)
(happens after JOIN notify and its following WHOIS).

CHANGES
lib/silcclient/client_entry.c

diff --git a/CHANGES b/CHANGES
index 914b012c02b9d3017c14ea89e8be27da1f7b9933..cda017613d576ae3a0b67d91caac67e70adeaa00 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
-Mon May 28 21:21:39 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+Mon May 28 23:21:39 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * 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.
index a6dc88d578946a133a49320a97725dc94166ed9a..a97adecd326319c7344132c011090937afd8a560 100644 (file)
@@ -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);
     }