From 034a1011e9037da3b4214356e168dcffb3eddfe3 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 14 May 2019 13:37:35 +0200 Subject: [PATCH] logging: fix stack overflow in logging for iov_data array This overflow could only happen when we would try to log a message with "NM_DEVICE=", "NM_CONNECTION=", and more than 8 logging domains (_NUM_MAX_FIELDS_SYSLOG_FACILITY - 2). The latter is never the case. While we sometimes log messages with more than one logging domain, there are no logging statements that use most as 8 different logging domains. So, this overflow is not actually reachable from current code (I think). Fixes: ed552c732c76 ('logging: log device and connection along with the message'): (cherry picked from commit 138c187376cff1c14c66a3fdc502d260178081bb) --- src/nm-logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-logging.c b/src/nm-logging.c index 48e51421b9..664926c12e 100644 --- a/src/nm-logging.c +++ b/src/nm-logging.c @@ -738,7 +738,7 @@ _nm_log_impl (const char *file, { gint64 now, boottime; #define _NUM_MAX_FIELDS_SYSLOG_FACILITY 10 - struct iovec iov_data[12 + _NUM_MAX_FIELDS_SYSLOG_FACILITY]; + struct iovec iov_data[14 + _NUM_MAX_FIELDS_SYSLOG_FACILITY]; struct iovec *iov = iov_data; gpointer iov_free_data[5]; gpointer *iov_free = iov_free_data;