From 78b7a846cabce457c7bf55098c49a6be5bfa6b8f Mon Sep 17 00:00:00 2001 From: Alfred Klomp Date: Sun, 28 Jan 2024 23:44:45 +0100 Subject: [PATCH] base64: line does not end with newline --- bin/base64.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bin/base64.c b/bin/base64.c index a7451b5..9b5d7d0 100644 --- a/bin/base64.c +++ b/bin/base64.c @@ -247,12 +247,11 @@ static bool write_wrapped (const struct config *config, char *buf, size_t len) { static size_t col = 0; - static char nl = '\x00'; // Special case: if buf is NULL, print final trailing newline. if (buf == NULL) { if (config->wrap > 0 && col > 0) { - return write_stdout(config, &nl, 1); + return write_stdout(config, "\n ", 2); } return true; } @@ -288,7 +287,7 @@ write_wrapped (const struct config *config, char *buf, size_t len) // If the line is full, append a newline. if (col == config->wrap) { - if (iov_append(config, iov, &nvec, &nl, 1) == false) { + if (iov_append(config, iov, &nvec, "\n ", 2) == false) { return false; } col = 0;