From: Lennart Poettering Date: Tue, 4 Mar 2025 14:41:12 +0000 (+0100) Subject: log: explicitly size log_target_max_level() X-Git-Tag: v258-rc1~1191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f4c37bc070c5546471836b0fac4df9f469557eb;p=thirdparty%2Fsystemd.git log: explicitly size log_target_max_level() We always validate that the target value is below _LOG_TARGET_SINGLE_MAX before acessing it, but we don't actually size the array like that. let's fix that. This doesn#t effectively change anything, but it makes things more explicit what the limit here is. --- diff --git a/src/basic/log.c b/src/basic/log.c index 51f3a4eeada..c1198d0f61d 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -50,7 +50,7 @@ static void *log_syntax_callback_userdata = NULL; static LogTarget log_target = LOG_TARGET_CONSOLE; static int log_max_level = LOG_INFO; -static int log_target_max_level[] = { +static int log_target_max_level[_LOG_TARGET_SINGLE_MAX] = { [LOG_TARGET_CONSOLE] = INT_MAX, [LOG_TARGET_KMSG] = INT_MAX, [LOG_TARGET_SYSLOG] = INT_MAX,