Page MenuHomeFreeBSD

D10662.diff
No OneTemporary

D10662.diff

Index: head/sbin/ipfw/dummynet.c
===================================================================
--- head/sbin/ipfw/dummynet.c
+++ head/sbin/ipfw/dummynet.c
@@ -805,8 +805,7 @@
warn("interface name truncated");
namelen--;
/* interface name */
- strncpy(if_name, arg, namelen);
- if_name[namelen] = '\0';
+ strlcpy(if_name, arg, namelen);
*bandwidth = 0;
} else { /* read bandwidth value */
int bw;
@@ -933,8 +932,7 @@
} else if (!strcasecmp(name, ED_TOK_NAME)) {
if (profile_name[0] != '\0')
errx(ED_EFMT("duplicated token: %s"), name);
- strncpy(profile_name, arg, sizeof(profile_name) - 1);
- profile_name[sizeof(profile_name)-1] = '\0';
+ strlcpy(profile_name, arg, sizeof(profile_name));
do_points = 0;
} else if (!strcasecmp(name, ED_TOK_DELAY)) {
if (do_points)
@@ -1005,7 +1003,7 @@
}
p->samples_no = 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
@@ -1568,7 +1566,8 @@
fs->flags &= ~(DN_IS_RED|DN_IS_GENTLE_RED);
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;
process_extra_parms(&ac, av, aqm_extra, tok);
@@ -1580,7 +1579,8 @@
errx(EX_DATAERR, "use type before fq_codel/fq_pie");
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;
process_extra_parms(&ac, av, sch_extra, tok);
break;
@@ -1649,14 +1649,15 @@
l = strlen(av[0]);
if (l == 0 || l > 15)
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 */
#ifdef NEW_AQM
/* if fq_codel is selected, consider all tokens after it
* as parameters
*/
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;
process_extra_parms(&ac, av, sch_extra, tok);
} else {

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 7, 12:15 AM (16 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17022112
Default Alt Text
D10662.diff (2 KB)

Event Timeline