mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
log: make each string generated in log_format_iovec() NUL terminated
Nowadays, we append an extra NUL for each data if possible for safety. We already do the same for example at write_to_kmsg(), log_do_context(), write_to_journal(), log_struct_iovec_internal(), and so on. This does not change any behavior, as the iov_len field is unchanged.
This commit is contained in:
@@ -950,8 +950,6 @@ int log_format_iovec(
|
||||
const char *format,
|
||||
va_list ap) {
|
||||
|
||||
static const char nl = '\n';
|
||||
|
||||
while (format && *n + 1 < iovec_len) {
|
||||
va_list aq;
|
||||
char *m;
|
||||
@@ -975,7 +973,7 @@ int log_format_iovec(
|
||||
|
||||
iovec[(*n)++] = IOVEC_MAKE_STRING(m);
|
||||
if (newline_separator)
|
||||
iovec[(*n)++] = IOVEC_MAKE((char *)&nl, 1);
|
||||
iovec[(*n)++] = IOVEC_MAKE_STRING("\n");
|
||||
|
||||
format = va_arg(ap, char *);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user