From: Yuan-Hsiang Lee Date: Sat, 2 Nov 2013 23:13:16 +0000 (+0100) Subject: init: fix illegal memory access when max message length is reached X-Git-Tag: 1_22_0~62 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b21bc80c7651bfb5a9e001cc220a598cf89b7cfd;p=oweals%2Fbusybox.git init: fix illegal memory access when max message length is reached Signed-off-by: Yuan-Hsiang Lee Signed-off-by: Denys Vlasenko --- 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