metrics: fix potential missing string termination
authorRemy Horton <remy.horton@intel.com>
Tue, 20 Feb 2018 16:05:59 +0000 (16:05 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 4 Apr 2018 15:33:08 +0000 (17:33 +0200)
commit255d42d5b612e9a88beee1576ea5bb33f0a74f57
treecc54ff274236927d26a4f4529de67c554bb05b8e
parentc022cb400e920624dd10e162ef12917b3039b846
metrics: fix potential missing string termination

Fixes a potential memory overrun detected by Coverity.
This overrun cannot currently happen in practice because
rte_metrics_reg_names() explicitly forces the last name
character to be a NULL terminator.

This patches uses strlcpy instead of strncpy to copy name strings.

Coverity issue: 143434
Fixes: 349950ddb9c5 ("metrics: add information metrics library")
Fixes: 710cab6f675a ("metrics: fix out of bound access")

Signed-off-by: Remy Horton <remy.horton@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_metrics/rte_metrics.c