]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: fix array size in unit_log_resources()
authorFlorian Schmaus <flo@geekplace.eu>
Thu, 9 Nov 2023 07:59:59 +0000 (08:59 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 9 Nov 2023 09:59:10 +0000 (09:59 +0000)
In 0531bded79dc ("core: include peak memory in unit_log_resources()") new log
messages where added, however the size of the according arrays to hold the
messages was not adjusted.

Fixes: 0531bded79dc ("core: include peak memory in unit_log_resources()")
src/core/unit.c

index d7e7da40c215c113d38c9638448ffc6a0daa9ba4..4ac8d0adc03ee0fd58509b44d9371ccbfa7b8bbf 100644 (file)
@@ -2319,12 +2319,12 @@ static int raise_level(int log_level, bool condition_info, bool condition_notice
 }
 
 static int unit_log_resources(Unit *u) {
-        struct iovec iovec[1 + _CGROUP_IP_ACCOUNTING_METRIC_MAX + _CGROUP_IO_ACCOUNTING_METRIC_MAX + 4];
+        struct iovec iovec[1 + 1 + _CGROUP_IP_ACCOUNTING_METRIC_MAX + _CGROUP_IO_ACCOUNTING_METRIC_MAX + 4];
         bool any_traffic = false, have_ip_accounting = false, any_io = false, have_io_accounting = false;
         _cleanup_free_ char *igress = NULL, *egress = NULL, *rr = NULL, *wr = NULL;
         int log_level = LOG_DEBUG; /* May be raised if resources consumed over a threshold */
         size_t n_message_parts = 0, n_iovec = 0;
-        char* message_parts[1 + 2 + 2 + 1], *t;
+        char* message_parts[1 + 1 + 2 + 2 + 1], *t;
         nsec_t nsec = NSEC_INFINITY;
         uint64_t memory_peak = UINT64_MAX;
         int r;