From d6e9aecfd67ebfd012873eb24b72221f13e8f089 Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Sun, 16 Dec 2018 23:44:54 +0100 Subject: String type: Not include \0 in show_version The string type does not include the \0 in strings. Change-Id: I869f438b84880df40a018e43b4510194d84ce0fe Signed-off-by: Ole Troan --- src/vlibapi/api_types.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/vlibapi') diff --git a/src/vlibapi/api_types.h b/src/vlibapi/api_types.h index ffcd24d12b2..8a86612f0fb 100644 --- a/src/vlibapi/api_types.h +++ b/src/vlibapi/api_types.h @@ -50,4 +50,10 @@ vl_api_string_len (vl_api_string_t * astr) return clib_net_to_host_u32 (astr->length); } +static inline char * +vl_api_from_api_string_c (vl_api_string_t *astr) +{ + return strndup((char *)astr->buf, clib_net_to_host_u32(astr->length)); +} + #endif -- cgit 1.2.3-korg