Commit 72f69ee87cb88d4e18fe6b05701bff275dc1b68f

Authored by Peng Fan
Committed by guoyin.chen
1 parent 0b2918d4a1

MLK-12200 common: cli_simple: use strlcpy instead of strcpy

Report Coverity log:
Destination buffer too small (STRING_OVERFLOW)
string_overflow: You might overrun the 1024 byte destination string
lastcommand by writing 1025 bytes from console_buffer

Signed-off-by: Peng Fan <peng.fan@nxp.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

... ... @@ -275,7 +275,8 @@
275 275  
276 276 flag = 0; /* assume no special flags for now */
277 277 if (len > 0)
278   - strcpy(lastcommand, console_buffer);
  278 + strlcpy(lastcommand, console_buffer,
  279 + CONFIG_SYS_CBSIZE + 1);
279 280 else if (len == 0)
280 281 flag |= CMD_FLAG_REPEAT;
281 282 #ifdef CONFIG_BOOT_RETRY_TIME