From bfd2fcb5f2fb5513a135810f2d3bf3500945347d Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Sun, 23 May 2021 15:50:14 +0200 Subject: [PATCH] CMD: Fix the trie print function --- src/net/listen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/listen.c b/src/net/listen.c index 14d81d80..269692a3 100644 --- a/src/net/listen.c +++ b/src/net/listen.c @@ -191,6 +191,7 @@ ___cmd_trie_print(struct cmd_trie_node *root, char *old_prefix, const size_t len char prefix[length + 2]; /* Old + new_char + \0 */ memcpy(prefix, old_prefix, sizeof(char) * length); prefix[length + 1] = '\0'; + prefix[length] = '\0'; switch (root->type) { /* Not a terminal node */ @@ -201,7 +202,7 @@ ___cmd_trie_print(struct cmd_trie_node *root, char *old_prefix, const size_t len case LKT_COMMAND_SIMPLE: case LKT_COMMAND_ANON: case LKT_COMMAND_INTEGER: - LKT_OUTPUT("CMD_TRIE", "Got function of type %d in trie: %s", root->type, prefix); + LKT_OUTPUT("CMD_TRIE", "Got function of type %d in trie '%s'", root->type, prefix); break; } -- GitLab