stats: fix use-after-free hash key string 56/20556/3
authorBenoît Ganne <bganne@cisco.com>
Mon, 8 Jul 2019 12:39:02 +0000 (14:39 +0200)
committerOle Trøan <otroan@employees.org>
Mon, 22 Jul 2019 10:11:32 +0000 (10:11 +0000)
commitf7c30df4bbeace3917164b249724d8cf0d8a6fec
treed13a8f21909d1544c15b73c2e311a68430be3d0f
parent1f50bf8fc57ebf78f9056185a342493be460a847
stats: fix use-after-free hash key string

Hash keys are not copied by the hash infrastructure, instead the pointer
is used directly. stat_segment_register_gauge() does not allocate a
private object for the key, causing issues when it is freed or reused.
Allocate a private object on insertion into the hashtable instead.

Type: fix
Fixes: 92e3082199d10add866894e86a9762d79a3536c4

Change-Id: Ifb6addfcaec81bdb7ea3512050ce55f06ef09a4c
Signed-off-by: Benoît Ganne <bganne@cisco.com>
src/vlib/error.c
src/vpp/stats/stat_segment.c