metrics: fix name string termination
authorRemy Horton <remy.horton@intel.com>
Tue, 18 Jul 2017 09:43:47 +0000 (10:43 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 19 Jul 2017 21:06:07 +0000 (00:06 +0300)
commitfa43ac77294a1a00b1fc30514162145ca17fa766
treec95c117b47c1dde3163e532978cad4f5c8cb10c3
parent838d6b775bfab436859764ea734cddaf95c7b5fd
metrics: fix name string termination

The public API (struct rte_metric_name) includes the NULL terminator
byte in RTE_METRICS_MAX_NAME_LENGTH but the library itself internally
excludes it. This makes it possible for an application to receive an
unterminated name string. Fix be enforcing the NULL termination of all
name strings to the length that the public API expects.

Fixes: 349950ddb9c5 ("metrics: add information metrics library")
Cc: stable@dpdk.org
Signed-off-by: Remy Horton <remy.horton@intel.com>
lib/librte_metrics/rte_metrics.c
lib/librte_metrics/rte_metrics.h