[U-Boot] [PATCH] Fix GCC format-security errors.

ben.whitten at gmail.com ben.whitten at gmail.com
Tue Dec 29 15:34:27 CET 2015


From: Ben Whitten <ben.whitten at gmail.com>

With format-security errors turned on, GCC picks up the use of sprintf without
a format parameter.

Signed-off-by: Ben Whitten <ben.whitten at gmail.com>
---
 common/cmd_elf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 86e694a..3677702 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -289,7 +289,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		} else {
 			tmp = getenv("bootdev");
 			if (tmp)
-				ptr = sprintf(build_buf, tmp);
+				ptr = sprintf(build_buf, "%s", tmp);
 			else
 				printf("## VxWorks boot device not specified\n");

@@ -332,7 +332,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])

 			tmp = getenv("othbootargs");
 			if (tmp)
-				ptr += sprintf(build_buf + ptr, tmp);
+				ptr += sprintf(build_buf + ptr, "%s", tmp);

 			memcpy((void *)bootaddr, build_buf,
 			       max(strlen(build_buf), (size_t)255));
--
2.6.4



More information about the U-Boot mailing list