[dpdk-stable] [dpdk-dev] [PATCH 1/5] net/bonding: fix buffer length when printing strings

Bruce Richardson bruce.richardson at intel.com
Wed Apr 3 17:51:17 CEST 2019


On Wed, Apr 03, 2019 at 08:47:58AM -0700, Stephen Hemminger wrote:
> On Wed,  3 Apr 2019 15:45:01 +0100
> Bruce Richardson <bruce.richardson at intel.com> wrote:
> 
> >  
> >  static void
> > -arp_op_name(uint16_t arp_op, char *buf)
> > +arp_op_name(uint16_t arp_op, char *buf, size_t buf_len)
> >  {
> >  	switch (arp_op) {
> >  	case ARP_OP_REQUEST:
> > -		snprintf(buf, sizeof("ARP Request"), "%s", "ARP Request");
> > +		snprintf(buf, buf_len, "%s", "ARP Request");
> >  		return;
> This should be strlcpy not snprintf

Yes, it should, but I just let that get fixed by cocci script in the later
patch. For this one, I just fixed the most egregious error.


More information about the stable mailing list