]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
verify edge order in compressed nodes
authorAlan T. DeKok <aland@freeradius.org>
Sat, 23 Mar 2019 18:07:25 +0000 (14:07 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 23 Mar 2019 18:27:43 +0000 (14:27 -0400)
src/lib/util/trie.c

index 24a60096dfb752b947564708951622e454ecf243..e1a1acd281d6715bfca738706fcaa8885487b260 100644 (file)
@@ -2358,6 +2358,14 @@ static int fr_trie_comp_verify(fr_trie_t *trie)
                        return -1;
                }
 
+               if ((i + 1) < comp->used) {
+                       if (comp->index[i] >= comp->index[i + 1]) {
+                               fr_strerror_printf("comp node has inverted edges at %d (%04x >= %04x)",
+                                                  i, comp->index[i], comp->index[i + 1]);
+                               return -1;
+                       }
+               }
+
                if (fr_trie_verify(comp->trie[i]) < 0) return -1;
                used++;
        }