Blame SOURCES/0003-libibnetdisc-fix-printing-a-possibly-non-NUL-termina.patch

168450
From 45fcc7ad41216a93bafb452f7d7a4507d52722cd Mon Sep 17 00:00:00 2001
168450
From: Michal Schmidt <mschmidt@redhat.com>
168450
Date: Wed, 1 Feb 2023 23:30:52 +0100
168450
Subject: [PATCH 3/3] libibnetdisc: fix printing a possibly non-NUL-terminated
168450
 string
168450
168450
Found by a static check (covscan).
168450
168450
Fixes: d974c4e398d2 ("Fix max length of node description (ibnetdiscover and smpquery)")
168450
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
168450
---
168450
 libibnetdisc/chassis.c | 3 ++-
168450
 1 file changed, 2 insertions(+), 1 deletion(-)
168450
168450
diff --git a/libibnetdisc/chassis.c b/libibnetdisc/chassis.c
168450
index a3ec1d82807c..bc1a8aff8acb 100644
168450
--- a/libibnetdisc/chassis.c
168450
+++ b/libibnetdisc/chassis.c
168450
@@ -597,7 +597,7 @@ static int fill_mellanox_chassis_record(ibnd_node_t * node)
168450
 	int p = 0;
168450
 	ibnd_port_t *port;
168450
 
168450
-	char node_desc[IB_SMP_DATA_SIZE];
168450
+	char node_desc[IB_SMP_DATA_SIZE + 1];
168450
 	char *system_name;
168450
 	char *system_type;
168450
 	char *system_slot_name;
168450
@@ -617,6 +617,7 @@ static int fill_mellanox_chassis_record(ibnd_node_t * node)
168450
 	 */
168450
 
168450
 	memcpy(node_desc, node->nodedesc, IB_SMP_DATA_SIZE);
168450
+	node_desc[IB_SMP_DATA_SIZE] = '\0';
168450
 
168450
 	IBND_DEBUG("fill_mellanox_chassis_record: node_desc:%s \n",node_desc);
168450
 
168450
-- 
168450
2.39.1
168450