diff options
author | Ben Whitten <ben.whitten@gmail.com> | 2015-12-30 13:05:58 +0000 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-01-14 22:11:34 -0500 |
commit | 192bc6948b02ff4168cab16162fffb507946dc2b (patch) | |
tree | b49cf85a3fa910182ce7dc2508f00ccb8ade03d4 /common/cmd_elf.c | |
parent | 4edde96111aefac63d6aaca6ba87a90d149e973e (diff) | |
download | u-boot-192bc6948b02ff4168cab16162fffb507946dc2b.tar.gz |
Fix GCC format-security errors and convert sprintfs.
With format-security errors turned on, GCC picks up the use of sprintf with
a format parameter not being a string literal.
Simple uses of sprintf are also converted to use strcpy.
Signed-off-by: Ben Whitten <ben.whitten@gmail.com>
Acked-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/cmd_elf.c')
-rw-r--r-- | common/cmd_elf.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/common/cmd_elf.c b/common/cmd_elf.c index 86e694ac69..5190cc6c0f 100644 --- a/common/cmd_elf.c +++ b/common/cmd_elf.c @@ -288,9 +288,10 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) (size_t)255)); } else { tmp = getenv("bootdev"); - if (tmp) - ptr = sprintf(build_buf, tmp); - else + if (tmp) { + strcpy(build_buf, tmp); + ptr = strlen(tmp); + } else printf("## VxWorks boot device not specified\n"); tmp = getenv("bootfile"); @@ -331,8 +332,10 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ptr += sprintf(build_buf + ptr, "tn=%s ", tmp); tmp = getenv("othbootargs"); - if (tmp) - ptr += sprintf(build_buf + ptr, tmp); + if (tmp) { + strcpy(build_buf + ptr, tmp); + ptr += strlen(tmp); + } memcpy((void *)bootaddr, build_buf, max(strlen(build_buf), (size_t)255)); |