From 932d1511eeedb8275a0517964e4af4dfeffd4998 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Thu, 15 Jun 2023 21:12:27 +0300 Subject: [PATCH 11/11] Fix gcc-14 warning about packet.conn_id_new[] subscript See osdn #48248 Signed-off-by: Marko Lindqvist --- server/sernet.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/server/sernet.c b/server/sernet.c index 9c6ac5cd15..5cc4000f07 100644 --- a/server/sernet.c +++ b/server/sernet.c @@ -1467,12 +1467,17 @@ static void send_ping_times_to_all(void) if (!pconn->used) { continue; } - fc_assert(i < ARRAY_SIZE(packet.conn_id_new)); - packet.conn_id_new[i] = pconn->id; - packet.ping_time_6[i] = pconn->ping_time; - if (i < 256) { - packet.conn_id_old[i] = pconn->id; - packet.ping_time_7[i] = pconn->ping_time; /* _7 really is the OLD protocol */ + + if (i < ARRAY_SIZE(packet.conn_id_new)) { + packet.conn_id_new[i] = pconn->id; + packet.ping_time_6[i] = pconn->ping_time; + if (i < 256) { + packet.conn_id_old[i] = pconn->id; + /* _7 really is the OLD protocol */ + packet.ping_time_7[i] = pconn->ping_time; + } + } else { + fc_assert(i < ARRAY_SIZE(packet.conn_id_new)); /* Always fails */ } i++; } conn_list_iterate_end; -- 2.39.2