common: nvedit: use snprintf instead of sprintf
PATCH v2 1/1 common: nvedit: use snprintf instead of sprintf
From: Peng Fan <[email protected]>
Use snprintf to replace sprintf.
Coverity log:
"
Unbounded source buffer (STRING_SIZE)string_size: Passing string init_val of unknown size to sprintf. "
Reported-by Coverity
Signed-off-by Peng Fan <[email protected]>
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
Reviewed-by Joe Hershberger <[email protected]>
--- common/cmd_nvedit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/cmd_nvedit.c +1 -1
@@ -594,7 +594,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,/* Set read buffer to initial value or empty sting */ init_val =getenv (argv[1 ]);if (init_val) -sprintf (buffer,"%s" , init_val); +snprintf (buffer,CONFIG_SYS_CBSIZE ,"%s" , init_val);else buffer[0 ] ='\0' ;
Signature · 1 line
2.6.2
PATCH v2 1/1 common: nvedit: use snprintf instead of sprintf
Quoted 10 lines · Peng Fan
From: Peng Fan <[email protected]>
Use snprintf to replace sprintf.
Coverity log:
"
Unbounded source buffer (STRING_SIZE)string_size: Passing stringinit_valof unknown size to sprintf. "
Quoted 5 lines
Reported-by CoveritySigned-off-by Peng Fan <[email protected]>Cc Tom Rini <[email protected]>Cc Simon Glass <[email protected]>Reviewed-by Joe Hershberger <[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/20160104/cbbeaf2a/attachment.sig>