diff options
author | Daniel Mack <github@zonque.org> | 2016-01-12 15:06:41 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2016-01-12 15:06:41 +0100 |
commit | 4a6a24be180337f405591c7fa4fa112a765c53bb (patch) | |
tree | a6eb4b1a262e3653e97aa063eb2053a04ffd142f | |
parent | f466acdc633fc496961eff0c7f66501f4588e5b6 (diff) | |
parent | 13f5402c6b734ed4c2b3e8b7c3d3bf6d815e7661 (diff) |
Merge pull request #2303 from aadamowski/fix-miscalculated-buffer
Fix miscalculated buffer size and uses of size-unlimited sprintf()
-rw-r--r-- | src/journal/journald-syslog.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c index 2f7a805f14..b4fdec3d90 100644 --- a/src/journal/journald-syslog.c +++ b/src/journal/journald-syslog.c @@ -326,7 +326,7 @@ void server_process_syslog_message( size_t label_len) { char syslog_priority[sizeof("PRIORITY=") + DECIMAL_STR_MAX(int)], - syslog_facility[sizeof("SYSLOG_FACILITY") + DECIMAL_STR_MAX(int)]; + syslog_facility[sizeof("SYSLOG_FACILITY=") + DECIMAL_STR_MAX(int)]; const char *message = NULL, *syslog_identifier = NULL, *syslog_pid = NULL; struct iovec iovec[N_IOVEC_META_FIELDS + 6]; unsigned n = 0; @@ -357,11 +357,11 @@ void server_process_syslog_message( IOVEC_SET_STRING(iovec[n++], "_TRANSPORT=syslog"); - sprintf(syslog_priority, "PRIORITY=%i", priority & LOG_PRIMASK); + snprintf(syslog_priority, sizeof(syslog_priority), "PRIORITY=%i", priority & LOG_PRIMASK); IOVEC_SET_STRING(iovec[n++], syslog_priority); if (priority & LOG_FACMASK) { - sprintf(syslog_facility, "SYSLOG_FACILITY=%i", LOG_FAC(priority)); + snprintf(syslog_facility, sizeof(syslog_facility), "SYSLOG_FACILITY=%i", LOG_FAC(priority)); IOVEC_SET_STRING(iovec[n++], syslog_facility); } |