From 534ba8132818524bdf52d5dcf249dda51f766efb Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Tue, 3 May 2011 22:32:48 +0200 Subject: logging: make sure the output is null-terminated If we reach the buffer size or snprintf fails, we want to make sure that the output is null-terminated. --- src/logging.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/logging.c b/src/logging.c index 6797afcd..0911010a 100644 --- a/src/logging.c +++ b/src/logging.c @@ -493,6 +493,7 @@ const char *log_vty_command_string(const struct log_info *info) goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); err: + str[size-1] = '\0'; return str; } @@ -544,6 +545,7 @@ const char *log_vty_command_description(const struct log_info *info) OSMO_SNPRINTF_RET(ret, rem, offset, len); } err: + str[size-1] = '\0'; return str; } -- cgit v1.2.3