summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-08-21 02:24:07 +0200
committerRenato Westphal <renato@opensourcerouting.org>2020-08-26 17:21:27 +0200
commit69052f3d3363646484816ebe4e2d549aab8c2b53 (patch)
tree458a5babda4232fe4f341e4bbf369c68a10d6f59 /isisd
parentMerge pull request #7001 from ton31337/fix/deadcode_bgp_show_all_instances_ne... (diff)
downloadfrr-69052f3d3363646484816ebe4e2d549aab8c2b53.tar.xz
frr-69052f3d3363646484816ebe4e2d549aab8c2b53.zip
isisd: make vid2string() fully reentrant
Always fill the buffer provided by the user to prevent unexpected results and make the function fully reentrant. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_spf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index ebce86bed..6f3c125e9 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -155,7 +155,9 @@ static const char *vtype2string(enum vertextype vtype)
const char *vid2string(struct isis_vertex *vertex, char *buff, int size)
{
if (VTYPE_IS(vertex->type) || VTYPE_ES(vertex->type)) {
- return print_sys_hostname(vertex->N.id);
+ const char *hostname = print_sys_hostname(vertex->N.id);
+ strlcpy(buff, hostname, size);
+ return buff;
}
if (VTYPE_IP(vertex->type)) {