From 232c7382ded45775f777567183675c3c1f448807 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 17 Sep 2023 20:16:35 +0200 Subject: [PATCH] Silence compiler warning in Init_New_Client() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 06c34bbf..48768514 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -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;