chiark / gitweb /
journald: fix some xsprrintf() buffer size fallout
authorLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2015 17:17:00 +0000 (18:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 3 Feb 2015 17:17:00 +0000 (18:17 +0100)
src/journal/journald-kmsg.c
src/journal/journald-syslog.c

index 0b02eff6ef94be3587b2b255b06e1857a45f5540..c4216c4043370bb8047c99a07faf9336cc9bfe16 100644 (file)
@@ -40,7 +40,7 @@ void server_forward_kmsg(
         const struct ucred *ucred) {
 
         struct iovec iovec[5];
         const struct ucred *ucred) {
 
         struct iovec iovec[5];
-        char header_priority[4],
+        char header_priority[DECIMAL_STR_MAX(priority) + 3],
              header_pid[sizeof("[]: ")-1 + DECIMAL_STR_MAX(pid_t) + 1];
         int n = 0;
         char *ident_buf = NULL;
              header_pid[sizeof("[]: ")-1 + DECIMAL_STR_MAX(pid_t) + 1];
         int n = 0;
         char *ident_buf = NULL;
index 355f6e6a4b52e00fb8e746e02229ebe5fecb7d30..7d545ca31d78b7b9b346806c75f00abb347bdf26 100644 (file)
@@ -124,7 +124,7 @@ static void forward_syslog_raw(Server *s, int priority, const char *buffer, cons
 
 void server_forward_syslog(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred, const struct timeval *tv) {
         struct iovec iovec[5];
 
 void server_forward_syslog(Server *s, int priority, const char *identifier, const char *message, const struct ucred *ucred, const struct timeval *tv) {
         struct iovec iovec[5];
-        char header_priority[4], header_time[64],
+        char header_priority[DECIMAL_STR_MAX(priority) + 3], header_time[64],
              header_pid[sizeof("[]: ")-1 + DECIMAL_STR_MAX(pid_t) + 1];
         int n = 0;
         time_t t;
              header_pid[sizeof("[]: ")-1 + DECIMAL_STR_MAX(pid_t) + 1];
         int n = 0;
         time_t t;