diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-27 08:00:11 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-02-01 17:21:39 -0500 |
commit | 5ffa8c818120e35c89becd938d160235c069dd12 (patch) | |
tree | e4a1ce20a003e23618bd54f49cb4acf68aed70cd /src/journal/journald-server.c | |
parent | 294929f8916ca37d89ccb1757868d22f8068c56b (diff) |
Add a snprinf wrapper which checks that the buffer was big enough
If we scale our buffer to be wide enough for the format string, we
should expect that the calculation was correct.
char_array_0() invocations are removed, since snprintf nul-terminates
the output in any case.
A similar wrapper is used for strftime calls, but only in timedatectl.c.
Diffstat (limited to 'src/journal/journald-server.c')
-rw-r--r-- | src/journal/journald-server.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 87b459b3ca..aecf8596dc 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -837,12 +837,10 @@ void server_driver_message(Server *s, sd_id128_t message_id, const char *format, va_start(ap, format); vsnprintf(buffer + 8, sizeof(buffer) - 8, format, ap); va_end(ap); - char_array_0(buffer); IOVEC_SET_STRING(iovec[n++], buffer); if (!sd_id128_equal(message_id, SD_ID128_NULL)) { snprintf(mid, sizeof(mid), LOG_MESSAGE_ID(message_id)); - char_array_0(mid); IOVEC_SET_STRING(iovec[n++], mid); } |