diff options
author | Pavel Tvrdik <pawel.tvrdik@gmail.com> | 2016-10-01 12:50:29 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-10-11 21:25:21 +0200 |
commit | c2564d34af9e01a828c24b0be7f269e5b036b5da (patch) | |
tree | 5f6b258a0cdad47c6b0b2649224ed516ddba0035 /filter/trie.c | |
parent | 7935b9d21228dcd1eb95ebcb056b2a815e3e854b (diff) |
Tree/Trie: Check the end of buffer
We set buffer->pos to buffer->end in function buffer_print() when
bvsnprintf() failed, so there would be uninitialized memory between
the old buffer->pos and the current buffer->pos.
Diffstat (limited to 'filter/trie.c')
-rw-r--r-- | filter/trie.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |