]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Silence compiler warning in Init_New_Client()
authorAlexander Barton <alex@barton.de>
Sun, 17 Sep 2023 18:16:35 +0000 (20:16 +0200)
committerAlexander Barton <alex@barton.de>
Sun, 17 Sep 2023 18:16:35 +0000 (20:16 +0200)
Use strdup() instead of pointless strndup() to fix the following
compiler warning:

client.c: In function ‘Init_New_Client’:
client.c:216:32: warning: ‘strndup’ specified bound 127 exceeds source size 5 [-Wstringop-overread]
  216 |                 client->away = strndup(DEFAULT_AWAY_MSG, CLIENT_AWAY_LEN - 1);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ngircd/client.c

index 06c34bbf8158209bec0db822b401854717de071c..48768514f950e4f1ad41db94d73375206defd739 100644 (file)
@@ -213,7 +213,7 @@ Init_New_Client(CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer,
                Generate_MyToken(client);
 
        if (Client_HasMode(client, 'a'))
-               client->away = strndup(DEFAULT_AWAY_MSG, CLIENT_AWAY_LEN - 1);
+               client->away = strdup(DEFAULT_AWAY_MSG);
 
        client->next = (POINTER *)My_Clients;
        My_Clients = client;