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
This commit is contained in:
Conrad Meyer 2017-04-13 17:47:44 +00:00
parent c6943f3abc
commit bcd8d3b805
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316777
2 changed files with 2 additions and 2 deletions

View File

@ -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;

View File

@ -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;