We have to use the *printf variant which returns the strlen() of the
resulting string, not the
how-much-would-have-been-printed-given-enough-space, in order to use
that value to inspect the last character in the string.

Signed-off-by: Rasmus Villemoes <rasmus.villem...@prevas.dk>
---
 common/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/log.c b/common/log.c
index ea407c6db9..cba8df5caa 100644
--- a/common/log.c
+++ b/common/log.c
@@ -220,7 +220,7 @@ static int log_dispatch(struct log_rec *rec, const char 
*fmt, va_list args)
                        if (!rec->msg) {
                                int len;
 
-                               len = vsnprintf(buf, sizeof(buf), fmt, args);
+                               len = vscnprintf(buf, sizeof(buf), fmt, args);
                                rec->msg = buf;
                                gd->log_cont = len && buf[len - 1] != '\n';
                        }
-- 
2.29.2

Reply via email to