diff mbox

[U-Boot,v1,1/1] fix: possible overflow when copying the string

Message ID 1441614248-21941-1-git-send-email-imran.zaman@intel.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Imran Zaman Sept. 7, 2015, 8:24 a.m. UTC
Bigger source buffer than dest buffer could
overflow when copying strings.
Source and destination buffer sizes are same now.

Signed-off-by: Imran Zaman <imran.zaman@intel.com>
---
 common/cli_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tom Rini Sept. 15, 2015, 9:34 p.m. UTC | #1
On Mon, Sep 07, 2015 at 11:24:08AM +0300, Imran Zaman wrote:

> Bigger source buffer than dest buffer could
> overflow when copying strings.
> Source and destination buffer sizes are same now.
> 
> Signed-off-by: Imran Zaman <imran.zaman@intel.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/cli_simple.c b/common/cli_simple.c
index 00a8d2f..d8b40c9 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -258,7 +258,7 @@  int cli_simple_run_command(const char *cmd, int flag)
 
 void cli_simple_loop(void)
 {
-	static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
+	static char lastcommand[CONFIG_SYS_CBSIZE + 1] = { 0, };
 
 	int len;
 	int flag;