提交 a19428e5 编写于 作者: C Chen Gang 提交者: Linus Torvalds

kernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()

vsnprintf() may let 'r' larger than sizeof(buf), in this case, if 'r' is
also less than "vmcoreinfo_max_size - vmcoreinfo_size" (left size of
destination buffer), next memcpy() will read the unexpected addresses.
Signed-off-by: NChen Gang <gang.chen@asianux.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 53e0ee9f
...@@ -1537,7 +1537,7 @@ void vmcoreinfo_append_str(const char *fmt, ...) ...@@ -1537,7 +1537,7 @@ void vmcoreinfo_append_str(const char *fmt, ...)
size_t r; size_t r;
va_start(args, fmt); va_start(args, fmt);
r = vsnprintf(buf, sizeof(buf), fmt, args); r = vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
r = min(r, vmcoreinfo_max_size - vmcoreinfo_size); r = min(r, vmcoreinfo_max_size - vmcoreinfo_size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册