mdadm/0139-mdadm-Grow-fix-coverity-issue-STRING_OVERFLOW.patch

30 lines
898 B
Diff
Raw Normal View History

From 13c1f4a56b3bedbf802d66e86afd787e318e25fb Mon Sep 17 00:00:00 2001
From: Xiao Ni <xni@redhat.com>
Date: Fri, 26 Jul 2024 15:14:05 +0800
Subject: [PATCH 139/157] mdadm/Grow: fix coverity issue STRING_OVERFLOW
Fix string overflow problems in Grow.c
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
---
Grow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index 907a6e1b..a5f9027d 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1694,7 +1694,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
/* Current RAID6 layout has a RAID5
* equivalent - good
*/
- strcat(strcpy(layout, ls), "-6");
+ snprintf(layout, 40, "%s-6", ls);
l = map_name(r6layout, layout);
if (l == UnSet)
return "Cannot find RAID6 layout to convert to";
--
2.41.0