Commit 72f69ee87cb88d4e18fe6b05701bff275dc1b68f
Committed by
guoyin.chen
1 parent
0b2918d4a1
Exists in
smarc-imx_v2015.04_4.1.15_1.0.0_ga
and in
1 other branch
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
common/cli_simple.c
... | ... | @@ -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 |