public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kernel: debug: kdb: strncpy issue, using strlcpy instead of strncpy
@ 2013-05-16 11:44 Chen Gang
  0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2013-05-16 11:44 UTC (permalink / raw)
  To: jason.wessel; +Cc: kgdb-bugreport, linux-kernel@vger.kernel.org


'kdb_prompt_str' is NUL terminated string, need always set '\0' at the
end.

Or kdb_printf() below will cause issue.


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

diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
index 14ff484..932b436 100644
--- a/kernel/debug/kdb/kdb_io.c
+++ b/kernel/debug/kdb/kdb_io.c
@@ -442,7 +442,7 @@ poll_again:
 char *kdb_getstr(char *buffer, size_t bufsize, char *prompt)
 {
 	if (prompt && kdb_prompt_str != prompt)
-		strncpy(kdb_prompt_str, prompt, CMD_BUFLEN);
+		strlcpy(kdb_prompt_str, prompt, CMD_BUFLEN);
 	kdb_printf(kdb_prompt_str);
 	kdb_nextline = 1;	/* Prompt and input resets line number */
 	return kdb_read(buffer, bufsize);
-- 
1.7.7.6

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

only message in thread, other threads:[~2013-05-16 11:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 11:44 [PATCH v2] kernel: debug: kdb: strncpy issue, using strlcpy instead of strncpy Chen Gang

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