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