Skip to content

Commit

Permalink
isisd: check vertex type before checking its data
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rwestphal authored and idryzhov committed Nov 27, 2020
1 parent fd23bb7 commit a796b2f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion isisd/isis_spf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,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", "");
Expand Down

0 comments on commit a796b2f

Please sign in to comment.