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>
This commit is contained in:
@@ -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));
|
||||
|
||||
@@ -1086,7 +1086,7 @@ static int generate_mtdparts(char *buf, u32 buflen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
sprintf(p, "mtdparts=");
|
||||
strcpy(p, "mtdparts=");
|
||||
p += 9;
|
||||
|
||||
list_for_each(dentry, &devices) {
|
||||
|
||||
Reference in New Issue
Block a user