]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super-intel: Avoid gcc-8.1 complaining about truncating snprintf()
authorJes Sorensen <jsorensen@fb.com>
Wed, 30 May 2018 15:56:37 +0000 (11:56 -0400)
committerJes Sorensen <jsorensen@fb.com>
Wed, 30 May 2018 15:56:37 +0000 (11:56 -0400)
We know the max size of the volume name, so no need to play the
snprintf() game.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
super-intel.c

index cc53f0fc10e1b6b916de269ca753ee9cfb2f7cb3..520d29217f409dbb495ed42b69f76439e8128d1a 100644 (file)
@@ -9881,6 +9881,7 @@ static void imsm_process_update(struct supertype *st,
                /* sanity check that we are not affecting the uuid of
                 * an active array
                 */
+               memset(name, 0, sizeof(name));
                snprintf(name, MAX_RAID_SERIAL_LEN, "%s", (char *) u->name);
                name[MAX_RAID_SERIAL_LEN] = '\0';
                for (a = st->arrays; a; a = a->next)
@@ -9892,7 +9893,7 @@ static void imsm_process_update(struct supertype *st,
                        break;
                }
 
-               snprintf((char *) dev->volume, MAX_RAID_SERIAL_LEN, "%s", name);
+               memcpy(dev->volume, name, MAX_RAID_SERIAL_LEN);
                super->updates_pending++;
                break;
        }