diff options
author | Peng Fan <peng.fan@nxp.com> | 2015-12-23 12:08:09 +0800 |
---|---|---|
committer | guoyin.chen <guoyin.chen@freescale.com> | 2016-03-04 15:35:53 +0800 |
commit | d533473490c7a88fd9cc353b900c13d1ecc8f9b6 (patch) | |
tree | e72d1922d1cfa68e6bc991f1587d12b4364274f8 /common/cmd_nvedit.c | |
parent | d39dc0cda9e0e0788386abd8ad54ed3b49e43d6e (diff) | |
download | u-boot-imx-d533473490c7a88fd9cc353b900c13d1ecc8f9b6.zip u-boot-imx-d533473490c7a88fd9cc353b900c13d1ecc8f9b6.tar.gz u-boot-imx-d533473490c7a88fd9cc353b900c13d1ecc8f9b6.tar.bz2 |
common: nvedit: use snprintf instead of sprintf
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 <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
(cherry picked from commit 5d49b4cdf9417b88476567c8ec78ff185d84b10f)
Diffstat (limited to 'common/cmd_nvedit.c')
-rw-r--r-- | common/cmd_nvedit.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 24cc916..c4194d5 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -589,7 +589,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'; |