summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuan-Hsiang Lee <yhlee@ubnt.com>2013-11-02 23:13:16 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2013-11-02 23:13:16 (GMT)
commitb21bc80c7651bfb5a9e001cc220a598cf89b7cfd (patch)
tree1b8554170fa9cb14990706a29899d1fa004e566c
parent18b461925c6297f241c2b51f96f5d6d5f5de9e1d (diff)
downloadbusybox-b21bc80c7651bfb5a9e001cc220a598cf89b7cfd.tar.gz
busybox-b21bc80c7651bfb5a9e001cc220a598cf89b7cfd.tar.bz2
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>
-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