diff options
author | Chen Gang <gang.chen@asianux.com> | 2014-01-27 20:07:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-28 00:02:40 -0500 |
commit | a19428e5c3f4f39c302cb97b847dfd23613145c1 (patch) | |
tree | ef2341c5034451ae55e5c0ca0a727a4455ec6c44 /kernel | |
parent | 53e0ee9fc59cb17fcad57e481b5889c791afe6c3 (diff) |
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: Chen Gang <gang.chen@asianux.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/kexec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c index ac738781d356..60bafbed06ab 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -1537,7 +1537,7 @@ void vmcoreinfo_append_str(const char *fmt, ...) | |||
1537 | size_t r; | 1537 | size_t r; |
1538 | 1538 | ||
1539 | va_start(args, fmt); | 1539 | va_start(args, fmt); |
1540 | r = vsnprintf(buf, sizeof(buf), fmt, args); | 1540 | r = vscnprintf(buf, sizeof(buf), fmt, args); |
1541 | va_end(args); | 1541 | va_end(args); |
1542 | 1542 | ||
1543 | r = min(r, vmcoreinfo_max_size - vmcoreinfo_size); | 1543 | r = min(r, vmcoreinfo_max_size - vmcoreinfo_size); |