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