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>
num_m_args++;
else if (unformat (line_input, "mtu %d", &mtu))
num_m_args++;
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))
unformat_free (line_input);
return error;
unformat_free (line_input);
return error;
- u8 *tag = format (0, "%s", mp->tag);
+ mp->tag[ARRAY_LEN (mp->tag) - 1] = '\0';
rv =
map_create_domain ((ip4_address_t *) & mp->ip4_prefix.address,
mp->ip4_prefix.len,
rv =
map_create_domain ((ip4_address_t *) & mp->ip4_prefix.address,
mp->ip4_prefix.len,
mp->ip6_prefix.len,
(ip6_address_t *) & mp->ip6_src.address,
mp->ip6_src.len, mp->ea_bits_len, mp->psid_offset,
mp->ip6_prefix.len,
(ip6_address_t *) & mp->ip6_src.address,
mp->ip6_src.len, mp->ea_bits_len, mp->psid_offset,
- mp->psid_length, &index, ntohs (mp->mtu), flags, tag);
- vec_free (tag);
+ mp->psid_length, &index, ntohs (mp->mtu), flags,
+ mp->tag);
+
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_MAP_ADD_DOMAIN_REPLY,
({
/* *INDENT-OFF* */
REPLY_MACRO2(VL_API_MAP_ADD_DOMAIN_REPLY,
({