From: Renato Westphal Date: Fri, 20 Nov 2020 22:26:45 +0000 (-0300) Subject: isisd: check vertex type before checking its data X-Git-Tag: base_7.6~209^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=6f6adeee98290a3283dfdc5aa66c2a956c03af30;p=matthieu%2Ffrr.git isisd: check vertex type before checking its data vertex->N is an union whose "id" and "ip" fields are only valid depending on the vertex type (IS adjacency or IP reachability information). As such, add a vertex type check before consulting vertex->N.id in order to prevent unexpected behavior from happening. Signed-off-by: Renato Westphal --- diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 19cacde4fe..58b0cf2684 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1811,7 +1811,8 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue, "Vertex Type Metric Next-Hop Interface Parent\n"); for (ALL_QUEUE_ELEMENTS_RO(queue, node, vertex)) { - if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) { + if (VTYPE_IS(vertex->type) + && memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) { vty_out(vty, "%-20s %-12s %-6s", print_sys_hostname(root_sysid), "", ""); vty_out(vty, "%-30s\n", "");