Skip to content

Commit a796b2f

Browse files
rwestphalidryzhov
authored andcommitted
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 <[email protected]>
1 parent fd23bb7 commit a796b2f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

isisd/isis_spf.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,8 @@ static void isis_print_paths(struct vty *vty, struct isis_vertex_queue *queue,
15211521
"Vertex Type Metric Next-Hop Interface Parent\n");
15221522

15231523
for (ALL_QUEUE_ELEMENTS_RO(queue, node, vertex)) {
1524-
if (memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
1524+
if (VTYPE_IS(vertex->type)
1525+
&& memcmp(vertex->N.id, root_sysid, ISIS_SYS_ID_LEN) == 0) {
15251526
vty_out(vty, "%-20s %-12s %-6s",
15261527
print_sys_hostname(root_sysid), "", "");
15271528
vty_out(vty, "%-30s\n", "");

0 commit comments

Comments
 (0)