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

Stephen Hemminger stephen at networkplumber.org
Wed Apr 3 17:47:58 CEST 2019


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


More information about the dev mailing list