summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-10-04 18:03:18 +0200
committerDave Wallace <dwallacelf@gmail.com>2023-10-09 21:38:26 +0000
commitb53daca83f6a4dda015f07a766cdae8707570010 (patch)
treed4d444f8139f5b46a517f9f41bde05bfdd1dc24d
parent15d0c7a3fb015868c5e391b9c862c5a83ea1f471 (diff)
vppinfra: fix string termination in clib_file_get_resolved_basename
Type: fix Fixes: 40f4810 Change-Id: Idf51462c8154663de23154f17a894b7245c9fbf0 Signed-off-by: Damjan Marion <damarion@cisco.com> (cherry picked from commit 08600ccfa12f529d6ca7b852106227fc5f7addbf)
-rw-r--r--src/vppinfra/unix-misc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/vppinfra/unix-misc.c b/src/vppinfra/unix-misc.c
index 0c5d96c6bb7..2918fc32328 100644
--- a/src/vppinfra/unix-misc.c
+++ b/src/vppinfra/unix-misc.c
@@ -148,6 +148,7 @@ clib_file_get_resolved_basename (char *fmt, ...)
r = readlink ((char *) link, buffer, sizeof (buffer) - 1);
vec_free (link);
+ buffer[r] = 0;
if (r < 1)
return 0;
@@ -159,6 +160,7 @@ clib_file_get_resolved_basename (char *fmt, ...)
while (p[0])
vec_add1 (s, p++[0]);
+ vec_add1 (s, 0);
return s;
}