summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--filter/tree.c3
-rw-r--r--filter/trie.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/filter/tree.c b/filter/tree.c
index 328c7184..1196e630 100644
--- a/filter/tree.c
+++ b/filter/tree.c
@@ -165,6 +165,9 @@ tree_format(struct f_tree *t, buffer *buf)
tree_node_format(t, buf);
+ if (buf->pos == buf->end)
+ return;
+
/* Undo last separator */
if (buf->pos[-1] != '[')
buf->pos -= 2;
diff --git a/filter/trie.c b/filter/trie.c
index fba395d1..565ae82f 100644
--- a/filter/trie.c
+++ b/filter/trie.c
@@ -300,6 +300,9 @@ trie_format(struct f_trie *t, buffer *buf)
buffer_print(buf, "%I/%d, ", IPA_NONE, 0);
trie_node_format(t->root, buf);
+ if (buf->pos == buf->end)
+ return;
+
/* Undo last separator */
if (buf->pos[-1] != '[')
buf->pos -= 2;