From b21bc80c7651bfb5a9e001cc220a598cf89b7cfd Mon Sep 17 00:00:00 2001 From: Yuan-Hsiang Lee Date: Sun, 3 Nov 2013 00:13:16 +0100 Subject: init: fix illegal memory access when max message length is reached Signed-off-by: Yuan-Hsiang Lee Signed-off-by: Denys Vlasenko --- init/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'init') diff --git a/init/init.c b/init/init.c index cc6a2b5be..2dcdfd471 100644 --- a/init/init.c +++ b/init/init.c @@ -222,8 +222,8 @@ static void message(int where, const char *fmt, ...) msg[0] = '\r'; va_start(arguments, fmt); l = 1 + vsnprintf(msg + 1, sizeof(msg) - 2, fmt, arguments); - if (l > sizeof(msg) - 1) - l = sizeof(msg) - 1; + if (l > sizeof(msg) - 2) + l = sizeof(msg) - 2; va_end(arguments); #if ENABLE_FEATURE_INIT_SYSLOG -- cgit v1.2.3