summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2015-12-23 12:08:09 +0800
committerTom Rini <trini@konsulko.com>2016-01-04 12:25:36 -0500
commit5d49b4cdf9417b88476567c8ec78ff185d84b10f (patch)
treecc33b0326c79581071c9c86a3efb36672280a4c9
parent5a6894397a657edec5d0cf4e20968cc66a368c51 (diff)
downloadu-boot-imx-5d49b4cdf9417b88476567c8ec78ff185d84b10f.zip
u-boot-imx-5d49b4cdf9417b88476567c8ec78ff185d84b10f.tar.gz
u-boot-imx-5d49b4cdf9417b88476567c8ec78ff185d84b10f.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>
-rw-r--r--common/cmd_nvedit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 2f9cdd0..5ae9d9d 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -595,7 +595,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';