Browse Source

ospf6d: fix off-by-one on display of spf reasons

The loop should only iterate to array_size - 1.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Christian Franke 3 years ago
parent
commit
8548973ace
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ospf6d/ospf6_spf.c

+ 1 - 1
ospf6d/ospf6_spf.c

@@ -403,7 +403,7 @@ void ospf6_spf_reason_string (unsigned int reason, char *buf, int size)
   if (!buf)
     return;
 
-  for (bit = 0; bit <= (sizeof(ospf6_spf_reason_str) / sizeof(char *)); bit++)
+  for (bit = 0; bit < array_size(ospf6_spf_reason_str); bit++)
     {
       if ((reason & (1 << bit)) && (len < size))
 	{