public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: frv: kernel: using vsnprintf() instead of vsprintf()
@ 2013-05-27  5:46 Chen Gang
  0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2013-05-27  5:46 UTC (permalink / raw)
  To: dhowells@redhat.com, jesper.nilsson, Richard Kuo, Tejun Heo
  Cc: Andrew Morton, David Miller, linux-kernel@vger.kernel.org,
	Linux-Arch


Since die_if_kernel() is an extern common used function, better always
check the buffer length to avoid memory overflow by a long 'str'.


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/frv/kernel/traps.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 4bff48c..a6d105d 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -523,7 +523,7 @@ void die_if_kernel(const char *str, ...)
 		return;
 
 	va_start(va, str);
-	vsprintf(buffer, str, va);
+	vsnprintf(buffer, sizeof(buffer), str, va);
 	va_end(va);
 
 	console_verbose();
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-27  5:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-27  5:46 [PATCH] arch: frv: kernel: using vsnprintf() instead of vsprintf() Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox