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: ed552c732c ('logging: log device and connection along with the message'):
(cherry picked from commit 138c187376)
This commit is contained in:
Thomas Haller 2019-05-14 13:37:35 +02:00
parent 3309af1a2e
commit 034a1011e9
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;