summaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
authorYuan-Hsiang Lee2013-11-03 00:13:16 +0100
committerDenys Vlasenko2013-11-03 00:13:16 +0100
commitb21bc80c7651bfb5a9e001cc220a598cf89b7cfd (patch)
tree1b8554170fa9cb14990706a29899d1fa004e566c /init/init.c
parent18b461925c6297f241c2b51f96f5d6d5f5de9e1d (diff)
downloadbusybox-b21bc80c7651bfb5a9e001cc220a598cf89b7cfd.zip
busybox-b21bc80c7651bfb5a9e001cc220a598cf89b7cfd.tar.gz
init: fix illegal memory access when max message length is reached
Signed-off-by: Yuan-Hsiang Lee <yhlee@ubnt.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c4
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