[PATCH 1/2] Filter: Fix comparison of BGP path mask

Kazuki Yamaguchi k at rhe.jp
Fri Jun 26 09:44:09 CEST 2020


Add a missing return statement. Path masks with the same length were all
considered the same. Comparing two with different length would cause
out-of-bounds memory access.

This bug was introduced by version 2.0.4, commit 4c553c5a5b40 ("Filter
refactoring: dropped the recursion from the interpreter", 2018-12-27).
---
 filter/data.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/filter/data.c b/filter/data.c
index 402202554c2f..9547a4c84833 100644
--- a/filter/data.c
+++ b/filter/data.c
@@ -230,6 +230,7 @@ static int
 pm_same(const struct f_path_mask *m1, const struct f_path_mask *m2)
 {
   if (m1->len != m2->len)
+    return 0;
 
   for (uint i=0; i<m1->len; i++)
     if (!pmi_same(&(m1->item[i]), &(m2->item[i])))
-- 
2.27.0



More information about the Bird-users mailing list