diff --git a/sys/dev/raid/vinum/vinumconfig.c b/sys/dev/raid/vinum/vinumconfig.c index 1111111..2222222 100644 --- a/sys/dev/raid/vinum/vinumconfig.c +++ b/sys/dev/raid/vinum/vinumconfig.c @@ -1267,15 +1267,13 @@ /* Does the subdisk have a name? If not, give it one */ if (sd->name[0] == '\0') { /* no name */ - char sdsuffix[8]; /* form sd name suffix here */ - /* Do we have a plex name? */ if (sdindex >= 0) /* we have a plex */ - strcpy(sd->name, PLEX[sd->plexno].name); /* take it from there */ + /* take it from there, bounded so the suffix always fits */ + ksnprintf(sd->name, sizeof(sd->name), "%s.s%d", + PLEX[sd->plexno].name, sdindex); else /* no way */ throw_rude_remark(EINVAL, "Unnamed sd is not associated with a plex"); - ksprintf(sdsuffix, ".s%d", sdindex); /* form the suffix */ - strcat(sd->name, sdsuffix); /* and add it to the name */ } /* do we have complete info for this subdisk? */ if (sd->sectors < 0) @@ -1453,15 +1451,13 @@ /* Does the plex have a name? If not, give it one */ if (plex->name[0] == '\0') { /* no name */ - char plexsuffix[8]; /* form plex name suffix here */ /* Do we have a volume name? */ if (plex->volno >= 0) /* we have a volume */ - strcpy(plex->name, /* take it from there */ - VOL[plex->volno].name); + /* take it from there, bounded so the suffix always fits */ + ksnprintf(plex->name, sizeof(plex->name), "%s.p%d", + VOL[plex->volno].name, pindex); else /* no way */ throw_rude_remark(EINVAL, "Unnamed plex is not associated with a volume"); - ksprintf(plexsuffix, ".p%d", pindex); /* form the suffix */ - strcat(plex->name, plexsuffix); /* and add it to the name */ } if (isstriped(plex)) { plex->lock = (struct rangelock *)