mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 04:43:53 +00:00
Use snprintf instead of sprintf.
MFC after: 2 weeks
This commit is contained in:
parent
795c5f365e
commit
7201590bbf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363540
|
@ -771,7 +771,7 @@ g_ccd_create(struct gctl_req *req, struct g_class *mp)
|
|||
|
||||
/* Check all providers are valid */
|
||||
for (i = 0; i < *nprovider; i++) {
|
||||
sprintf(buf, "provider%d", i);
|
||||
snprintf(buf, sizeof(buf), "provider%d", i);
|
||||
pp = gctl_get_provider(req, buf);
|
||||
if (pp == NULL)
|
||||
return;
|
||||
|
@ -788,7 +788,7 @@ g_ccd_create(struct gctl_req *req, struct g_class *mp)
|
|||
|
||||
/* Create consumers and attach to all providers */
|
||||
for (i = 0; i < *nprovider; i++) {
|
||||
sprintf(buf, "provider%d", i);
|
||||
snprintf(buf, sizeof(buf), "provider%d", i);
|
||||
pp = gctl_get_provider(req, buf);
|
||||
cp = g_new_consumer(gp);
|
||||
error = g_attach(cp, pp);
|
||||
|
|
|
@ -224,7 +224,8 @@ g_part_vtoc8_create(struct g_part_table *basetable, struct g_part_parms *gpp)
|
|||
ncyls = pcyls - acyls;
|
||||
msize = ncyls * table->secpercyl;
|
||||
|
||||
sprintf(table->vtoc.ascii, "FreeBSD%lldM cyl %u alt %u hd %u sec %u",
|
||||
snprintf(table->vtoc.ascii, sizeof(table->vtoc.ascii),
|
||||
"FreeBSD%lldM cyl %u alt %u hd %u sec %u",
|
||||
(long long)(msize / 2048), ncyls, acyls, basetable->gpt_heads,
|
||||
basetable->gpt_sectors);
|
||||
be32enc(&table->vtoc.version, VTOC_VERSION);
|
||||
|
@ -338,7 +339,8 @@ vtoc8_set_rawsize(struct g_part_table *basetable, struct g_provider *pp)
|
|||
basetable->gpt_last = msize - 1;
|
||||
|
||||
bzero(table->vtoc.ascii, sizeof(table->vtoc.ascii));
|
||||
sprintf(table->vtoc.ascii, "FreeBSD%lldM cyl %u alt %u hd %u sec %u",
|
||||
snprintf(table->vtoc.ascii, sizeof(table->vtoc.ascii),
|
||||
"FreeBSD%lldM cyl %u alt %u hd %u sec %u",
|
||||
(long long)(msize / 2048), ncyls, acyls, basetable->gpt_heads,
|
||||
basetable->gpt_sectors);
|
||||
be16enc(&table->vtoc.physcyls, pcyls);
|
||||
|
|
|
@ -227,7 +227,7 @@ virstor_ctl_stop(struct gctl_req *req, struct g_class *cp)
|
|||
struct g_virstor_softc *sc;
|
||||
int error;
|
||||
|
||||
sprintf(param, "arg%d", i);
|
||||
snprintf(param, sizeof(param), "arg%d", i);
|
||||
name = gctl_get_asciiparam(req, param);
|
||||
if (name == NULL) {
|
||||
gctl_error(req, "No 'arg%d' argument", i);
|
||||
|
@ -565,7 +565,7 @@ virstor_ctl_remove(struct gctl_req *req, struct g_class *cp)
|
|||
int j, found;
|
||||
struct g_virstor_component *newcomp, *compbak;
|
||||
|
||||
sprintf(param, "arg%d", i);
|
||||
snprintf(param, sizeof(param), "arg%d", i);
|
||||
prov_name = gctl_get_asciiparam(req, param);
|
||||
if (prov_name == NULL) {
|
||||
gctl_error(req, "Error fetching argument '%s'", param);
|
||||
|
|
Loading…
Reference in a new issue