aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/format.c
diff options
context:
space:
mode:
authorOle Troan <otroan@employees.org>2024-08-01 14:06:24 +0200
committerBeno�t Ganne <bganne@cisco.com>2024-08-07 11:46:51 +0000
commit9aa833b144200e88a382f3583196533c95d5e68f (patch)
tree086f8a7e38570d4bcb7e87513711eb423323f917 /src/vppinfra/format.c
parentfa7b7a41e7ca9400dda2266a10dd9179be40c128 (diff)
vppapigen: ensure address types are nul terminated
A string generated from format() may not be nul terminated. Type: fix Change-Id: I88452e446c3504d70758e9009c65be5466034d92 Signed-off-by: Ole Troan <otroan@employees.org>
Diffstat (limited to 'src/vppinfra/format.c')
-rw-r--r--src/vppinfra/format.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vppinfra/format.c b/src/vppinfra/format.c
index cf17b8a1acb..642d3e20654 100644
--- a/src/vppinfra/format.c
+++ b/src/vppinfra/format.c
@@ -833,6 +833,16 @@ done:
return s;
}
+__clib_export char *
+format_c_string (u8 *s, const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ s = va_format (s, fmt, &args);
+ va_end (args);
+ vec_add1 (s, '\0');
+ return (char *) s;
+}
/*
* fd.io coding-style-patch-verification: ON