summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2017-04-27 07:30:48 +0000
committerLuiz Souza <luiz@netgate.com>2017-07-15 11:23:22 -0500
commitb27ca4e97a461cd023a7e9d1ccb96a0a8fb3ceed (patch)
tree3770f2903baa744c0bd15e9d2ffce532a173668d
parent4262d330eb40271f36c9e0c11d09a06e64653352 (diff)
downloadFreeBSD-src-b27ca4e97a461cd023a7e9d1ccb96a0a8fb3ceed.zip
FreeBSD-src-b27ca4e97a461cd023a7e9d1ccb96a0a8fb3ceed.tar.gz
MFC r316777 (by cem)
dummynet: Use strlcpy to appease static checkers Some dummynet modules used strcpy() to copy from a larger buffer (dn_aqm->name) to a smaller buffer (dn_extra_parms->name). It happens that the lengths of the strings in the dn_aqm buffers were always hardcoded to be smaller than the dn_extra_parms buffer ("CODEL", "PIE"). Use strlcpy() instead, to appease static checkers. No functional change. Reported by: Coverity CIDs: 1356163, 1356165 Sponsored by: Dell EMC Isilon (cherry picked from commit b5cebfa8d51591353618c9e05272f84af512540d)
-rw-r--r--sys/netpfil/ipfw/dn_aqm_codel.c2
-rw-r--r--sys/netpfil/ipfw/dn_aqm_pie.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/netpfil/ipfw/dn_aqm_codel.c b/sys/netpfil/ipfw/dn_aqm_codel.c
index 0080170..a095b33 100644
--- a/sys/netpfil/ipfw/dn_aqm_codel.c
+++ b/sys/netpfil/ipfw/dn_aqm_codel.c
@@ -416,7 +416,7 @@ aqm_codel_getconfig(struct dn_fsk *fs, struct dn_extra_parms * ep)
struct dn_aqm_codel_parms *ccfg;
if (fs->aqmcfg) {
- strcpy(ep->name, codel_desc.name);
+ strlcpy(ep->name, codel_desc.name, sizeof(ep->name));
ccfg = fs->aqmcfg;
ep->par[0] = ccfg->target / AQM_TIME_1US;
ep->par[1] = ccfg->interval / AQM_TIME_1US;
diff --git a/sys/netpfil/ipfw/dn_aqm_pie.c b/sys/netpfil/ipfw/dn_aqm_pie.c
index c2e4d43..85062e2 100644
--- a/sys/netpfil/ipfw/dn_aqm_pie.c
+++ b/sys/netpfil/ipfw/dn_aqm_pie.c
@@ -755,7 +755,7 @@ aqm_pie_getconfig (struct dn_fsk *fs, struct dn_extra_parms * ep)
{
struct dn_aqm_pie_parms *pcfg;
if (fs->aqmcfg) {
- strcpy(ep->name, pie_desc.name);
+ strlcpy(ep->name, pie_desc.name, sizeof(ep->name));
pcfg = fs->aqmcfg;
ep->par[0] = pcfg->qdelay_ref / AQM_TIME_1US;
ep->par[1] = pcfg->tupdate / AQM_TIME_1US;
OpenPOWER on IntegriCloud