[dpdk-stable] [PATCH v3] drivers: fix to replace strcat with strlcat

Pattan, Reshma reshma.pattan at intel.com
Wed Feb 27 11:26:56 CET 2019



> -----Original Message-----
> From: Chaitanya Babu, TalluriX
> Sent: Wednesday, February 27, 2019 6:03 AM
> To: dev at dpdk.org
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index dca61f03a..fac4e943f 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -12201,8 +12201,10 @@ i40e_update_customized_pctype(struct
> rte_eth_dev *dev, uint8_t *pkg,
>  			for (n = 0; n < proto_num; n++) {
>  				if (proto[n].proto_id != proto_id)
>  					continue;
> -				strcat(name, proto[n].name);
> -				strcat(name, "_");
> +				strlcat(name, proto[n].name,
> +					sizeof(name) - strlen(name) - 1);
> +				strlcat(name, "_",
> +					sizeof(name) - strlen(name) - 1);
>  				break;
>  			}
>  		}
You need to include rte_string_fns.h here , check the build failure at below link. 
http://patches.dpdk.org/patch/50535/

In other files the header is included indirectly, but I suggest include this explicitly to avoid any header dependencies .

Also, commit message heading should be "fix possible overflow with strlcat"? 

Thanks,
Reshma


More information about the stable mailing list