]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/Grow: fix coverity issue STRING_OVERFLOW
authorXiao Ni <xni@redhat.com>
Fri, 26 Jul 2024 07:14:05 +0000 (15:14 +0800)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Mon, 5 Aug 2024 09:07:39 +0000 (11:07 +0200)
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

diff --git a/Grow.c b/Grow.c
index 907a6e1b9e22f313ce614f4b49c25a0be6b44b64..a5f9027d93d82d03a1824f9e9120a51d256e066c 100644 (file)
--- 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";