diff options
author | Benoît Ganne <bganne@cisco.com> | 2020-01-21 18:24:44 +0100 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2020-01-27 20:37:58 +0000 |
commit | 3b37125bdb0251181f90a429a4532b339711cf89 (patch) | |
tree | 84131fc05ae4ecf24053d012eee3ffe1a2bf5593 /src/plugins/map/map.c | |
parent | 4d39f9c61c48d033ed5c9f729bdc975b58da29e8 (diff) |
map: api: fix tag overflow and leak
The 'tag' parameter is expected to be a NULL-terminated C-string in
callees:
- make sure it is null-terminated in both API and CLI cases
- do not allocate & copy the string into a non-NULL-terminated vector
in API case
- fix leak in CLI case
Type: fix
Change-Id: I221a489a226240548cdeb5e3663bbfb94eee4600
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/map/map.c')
-rw-r--r-- | src/plugins/map/map.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/map/map.c b/src/plugins/map/map.c index bc9b3df50ba..92d2337d0ba 100644 --- a/src/plugins/map/map.c +++ b/src/plugins/map/map.c @@ -551,7 +551,7 @@ map_add_domain_command_fn (vlib_main_t * vm, num_m_args++; else if (unformat (line_input, "mtu %d", &mtu)) num_m_args++; - else if (unformat (line_input, "tag %v", &tag)) + else if (unformat (line_input, "tag %s", &tag)) ; else { @@ -573,6 +573,7 @@ map_add_domain_command_fn (vlib_main_t * vm, mtu, flags, tag); done: + vec_free (tag); unformat_free (line_input); return error; |