From 4f4c37bc070c5546471836b0fac4df9f469557eb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Mar 2025 15:41:12 +0100 Subject: [PATCH] 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. --- src/basic/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/log.c b/src/basic/log.c index 51f3a4eead..c1198d0f61 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,