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>
This commit is contained in:
Damjan Marion
2023-10-04 18:03:18 +02:00
parent e111bbd121
commit 08600ccfa1

View File

@ -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;
}