Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Apr 2017 07:30:48 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r317488 - stable/11/sys/netpfil/ipfw
Message-ID:  <201704270730.v3R7UmDX030063@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Thu Apr 27 07:30:48 2017
New Revision: 317488
URL: https://svnweb.freebsd.org/changeset/base/317488

Log:
  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

Modified:
  stable/11/sys/netpfil/ipfw/dn_aqm_codel.c
  stable/11/sys/netpfil/ipfw/dn_aqm_pie.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netpfil/ipfw/dn_aqm_codel.c
==============================================================================
--- stable/11/sys/netpfil/ipfw/dn_aqm_codel.c	Thu Apr 27 06:52:30 2017	(r317487)
+++ stable/11/sys/netpfil/ipfw/dn_aqm_codel.c	Thu Apr 27 07:30:48 2017	(r317488)
@@ -416,7 +416,7 @@ aqm_codel_getconfig(struct dn_fsk *fs, s
 	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;

Modified: stable/11/sys/netpfil/ipfw/dn_aqm_pie.c
==============================================================================
--- stable/11/sys/netpfil/ipfw/dn_aqm_pie.c	Thu Apr 27 06:52:30 2017	(r317487)
+++ stable/11/sys/netpfil/ipfw/dn_aqm_pie.c	Thu Apr 27 07:30:48 2017	(r317488)
@@ -755,7 +755,7 @@ aqm_pie_getconfig (struct dn_fsk *fs, st
 {
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704270730.v3R7UmDX030063>