common: cli_simple: use strlcpy instead of strcpy
PATCH v2 1/1 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
---
Changes V2:
Use strlcpy instead of strncpy.
common/cli_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/cli_simple.c +2 -1
@@ -276,7 +276,8 @@ void cli_simple_loop(void) flag =0 ;/* assume no special flags for now */ if (len >0 ) -strcpy (lastcommand, console_buffer); +strlcpy (lastcommand, console_buffer, +CONFIG_SYS_CBSIZE +1 );else if (len ==0 ) flag |=CMD_FLAG_REPEAT ;#ifdef CONFIG_BOOT_RETRY_TIME
Signature · 1 line
2.6.2
PATCH v2 1/1 common: cli_simple: use strlcpy instead of strcpy
Quoted 9 lines · Peng Fan
Report Coverity log:
Destination buffer too small (STRING_OVERFLOW)string_overflow: You might overrun the 1024 byte destination string lastcommand by writing 1025 bytes fromconsole_bufferSigned-off-by Peng Fan <[email protected]>Cc Heiko Schocher <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>
Quoted 7 lines
---
Changes V2:
Use strlcpy instead of strncpy.common/cli_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
PATCH v2 1/1 common: cli_simple: use strlcpy instead of strcpy
In reply to Peng FanQuoted 10 lines · Peng Fan
Report Coverity log:
Destination buffer too small (STRING_OVERFLOW)string_overflow: You might overrun the 1024 byte destination string lastcommand by writing 1025 bytes fromconsole_bufferSigned-off-by Peng Fan <[email protected]>Cc Heiko Schocher <[email protected]>Cc Simon Glass <[email protected]>Cc Tom Rini <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160114/b0a0cd07/attachment.sig>