diff mbox series

[3/3] mdadm/Grow: fix coverity issue STRING_OVERFLOW

Message ID 20240722081736.20439-4-xni@redhat.com (mailing list archive)
State Superseded
Headers show
Series mdadm: fix coverity issues | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_11-PR success PR summary
mdraidci/vmtest-md-6_11-VM_Test-0 success Logs for build-kernel

Commit Message

Xiao Ni July 22, 2024, 8:17 a.m. UTC
Fix string overflow problems in Grow.c

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 Grow.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/Grow.c b/Grow.c
index e18f1db00a57..953251561cf8 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1694,6 +1694,8 @@  char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
 					/* Current RAID6 layout has a RAID5
 					 * equivalent - good
 					 */
+					if (strlen(ls) > (40-1))
+						pr_err("%s length is bigger than destination", ls);
 					strcat(strcpy(layout, ls), "-6");
 					l = map_name(r6layout, layout);
 					if (l == UnSet)