Use more secure snprintf function instead of strncpy
to prevent memory access violation.
Fixes:
40d1324423a4 ("net/i40e: get ddp profile protocol info")
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
tlv = (struct i40e_profile_tlv_section_record *)&proto[1];
for (i = j = 0; i < nb_rec; j++) {
pinfo[j].proto_id = tlv->data[0];
- strncpy(pinfo[j].name, (const char *)&tlv->data[1],
- I40E_DDP_NAME_SIZE);
+ snprintf(pinfo[j].name, I40E_DDP_NAME_SIZE, "%s",
+ (const char *)&tlv->data[1]);
i += tlv->len;
tlv = &tlv[tlv->len];
}