mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 23:43:25 +00:00
MFC r319900:
sbin/ipfw: strcpy, strncpy => strlcpy Reported by: Coverity CID: 1356162, 1356166 Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10662
This commit is contained in:
parent
067cbec26a
commit
52680b453d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=320782
@ -799,8 +799,7 @@ read_bandwidth(char *arg, int *bandwidth, char *if_name, int namelen)
|
|||||||
warn("interface name truncated");
|
warn("interface name truncated");
|
||||||
namelen--;
|
namelen--;
|
||||||
/* interface name */
|
/* interface name */
|
||||||
strncpy(if_name, arg, namelen);
|
strlcpy(if_name, arg, namelen);
|
||||||
if_name[namelen] = '\0';
|
|
||||||
*bandwidth = 0;
|
*bandwidth = 0;
|
||||||
} else { /* read bandwidth value */
|
} else { /* read bandwidth value */
|
||||||
int bw;
|
int bw;
|
||||||
@ -927,8 +926,7 @@ load_extra_delays(const char *filename, struct dn_profile *p,
|
|||||||
} else if (!strcasecmp(name, ED_TOK_NAME)) {
|
} else if (!strcasecmp(name, ED_TOK_NAME)) {
|
||||||
if (profile_name[0] != '\0')
|
if (profile_name[0] != '\0')
|
||||||
errx(ED_EFMT("duplicated token: %s"), name);
|
errx(ED_EFMT("duplicated token: %s"), name);
|
||||||
strncpy(profile_name, arg, sizeof(profile_name) - 1);
|
strlcpy(profile_name, arg, sizeof(profile_name));
|
||||||
profile_name[sizeof(profile_name)-1] = '\0';
|
|
||||||
do_points = 0;
|
do_points = 0;
|
||||||
} else if (!strcasecmp(name, ED_TOK_DELAY)) {
|
} else if (!strcasecmp(name, ED_TOK_DELAY)) {
|
||||||
if (do_points)
|
if (do_points)
|
||||||
@ -999,7 +997,7 @@ load_extra_delays(const char *filename, struct dn_profile *p,
|
|||||||
}
|
}
|
||||||
p->samples_no = samples;
|
p->samples_no = samples;
|
||||||
p->loss_level = loss * samples;
|
p->loss_level = loss * samples;
|
||||||
strncpy(p->name, profile_name, sizeof(p->name));
|
strlcpy(p->name, profile_name, sizeof(p->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NEW_AQM
|
#ifdef NEW_AQM
|
||||||
@ -1562,7 +1560,8 @@ end_mask:
|
|||||||
fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
|
fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
|
||||||
fs->flags |= DN_IS_AQM;
|
fs->flags |= DN_IS_AQM;
|
||||||
|
|
||||||
strcpy(aqm_extra->name,av[-1]);
|
strlcpy(aqm_extra->name, av[-1],
|
||||||
|
sizeof(aqm_extra->name));
|
||||||
aqm_extra->oid.subtype = DN_AQM_PARAMS;
|
aqm_extra->oid.subtype = DN_AQM_PARAMS;
|
||||||
|
|
||||||
process_extra_parms(&ac, av, aqm_extra, tok);
|
process_extra_parms(&ac, av, aqm_extra, tok);
|
||||||
@ -1574,7 +1573,8 @@ end_mask:
|
|||||||
errx(EX_DATAERR, "use type before fq_codel/fq_pie");
|
errx(EX_DATAERR, "use type before fq_codel/fq_pie");
|
||||||
|
|
||||||
NEED(sch, "fq_codel/fq_pie is only for schd");
|
NEED(sch, "fq_codel/fq_pie is only for schd");
|
||||||
strcpy(sch_extra->name,av[-1]);
|
strlcpy(sch_extra->name, av[-1],
|
||||||
|
sizeof(sch_extra->name));
|
||||||
sch_extra->oid.subtype = DN_SCH_PARAMS;
|
sch_extra->oid.subtype = DN_SCH_PARAMS;
|
||||||
process_extra_parms(&ac, av, sch_extra, tok);
|
process_extra_parms(&ac, av, sch_extra, tok);
|
||||||
break;
|
break;
|
||||||
@ -1643,14 +1643,15 @@ end_mask:
|
|||||||
l = strlen(av[0]);
|
l = strlen(av[0]);
|
||||||
if (l == 0 || l > 15)
|
if (l == 0 || l > 15)
|
||||||
errx(1, "type %s too long\n", av[0]);
|
errx(1, "type %s too long\n", av[0]);
|
||||||
strcpy(sch->name, av[0]);
|
strlcpy(sch->name, av[0], sizeof(sch->name));
|
||||||
sch->oid.subtype = 0; /* use string */
|
sch->oid.subtype = 0; /* use string */
|
||||||
#ifdef NEW_AQM
|
#ifdef NEW_AQM
|
||||||
/* if fq_codel is selected, consider all tokens after it
|
/* if fq_codel is selected, consider all tokens after it
|
||||||
* as parameters
|
* as parameters
|
||||||
*/
|
*/
|
||||||
if (!strcasecmp(av[0],"fq_codel") || !strcasecmp(av[0],"fq_pie")){
|
if (!strcasecmp(av[0],"fq_codel") || !strcasecmp(av[0],"fq_pie")){
|
||||||
strcpy(sch_extra->name,av[0]);
|
strlcpy(sch_extra->name, av[0],
|
||||||
|
sizeof(sch_extra->name));
|
||||||
sch_extra->oid.subtype = DN_SCH_PARAMS;
|
sch_extra->oid.subtype = DN_SCH_PARAMS;
|
||||||
process_extra_parms(&ac, av, sch_extra, tok);
|
process_extra_parms(&ac, av, sch_extra, tok);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user