"Using uninitialized element of array"
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
examples/simplelog.c | 3 ++-
lib/log_file.c | 1 +
lib/log_syslog.c | 1 +
tests/check_log.c | 1 +
4 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/examples/simplelog.c b/examples/simplelog.c
index 0752807..593dd5c 100644
--- a/examples/simplelog.c
+++ b/examples/simplelog.c
@@ -103,13 +103,14 @@ static const char *my_tags_stringify(uint32_t tags)
}
}
-static void
+static void
trace_logger(int32_t t,
struct qb_log_callsite *cs,
time_t timestamp,
const char *msg)
{
char output_buffer[QB_LOG_MAX_LEN];
+ output_buffer[0] = '\0';
qb_log_target_format(t, cs, timestamp, msg, output_buffer);
fprintf(stderr, "%s\n", output_buffer);
}
diff --git a/lib/log_file.c b/lib/log_file.c
index c374927..6598566 100644
--- a/lib/log_file.c
+++ b/lib/log_file.c
@@ -31,6 +31,7 @@ _file_logger(int32_t t,
if (f == NULL) {
return;
}
+ output_buffer[0] = '\0';
qb_log_target_format(t, cs, timestamp, msg, output_buffer);
diff --git a/lib/log_syslog.c b/lib/log_syslog.c
index 16a3da0..a6928be 100644
--- a/lib/log_syslog.c
+++ b/lib/log_syslog.c
@@ -43,6 +43,7 @@ _syslog_logger(int32_t target,
return;
}
+ output_buffer[0] = '\0';
qb_log_target_format(target, cs, timestamp, msg, output_buffer);
if (final_priority < LOG_EMERG) {
diff --git a/tests/check_log.c b/tests/check_log.c
index b399c31..19f84f1 100644
--- a/tests/check_log.c
+++ b/tests/check_log.c
@@ -155,6 +155,7 @@ _test_logger(int32_t t,
struct qb_log_callsite *cs,
time_t timestamp, const char *msg)
{
+ test_buf[0] = '\0';
qb_log_target_format(t, cs, timestamp, msg, test_buf);
test_priority = cs->priority;
num_msgs++;
--
1.7.7.6