[git commit] init: fix illegal memory access when max message length is reached

Denys Vlasenko vda.linux at googlemail.com
Sat Nov 2 23:13:16 UTC 2013


commit: http://git.busybox.net/busybox/commit/?id=b21bc80c7651bfb5a9e001cc220a598cf89b7cfd
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Yuan-Hsiang Lee <yhlee at ubnt.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 init/init.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/init/init.c b/init/init.c
index cc6a2b5..2dcdfd4 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


More information about the busybox-cvs mailing list