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:
Ben Whitten
2015-12-30 13:05:58 +00:00
committed by Tom Rini
parent 4edde96111
commit 192bc6948b
53 changed files with 75 additions and 72 deletions

View File

@@ -355,7 +355,7 @@ int mpc82xx_scc_enet_initialize(bd_t *bis)
dev = (struct eth_device *) malloc(sizeof *dev);
memset(dev, 0, sizeof *dev);
sprintf(dev->name, "SCC");
strcpy(dev->name, "SCC");
dev->init = sec_init;
dev->halt = sec_halt;
dev->send = sec_send;

View File

@@ -148,7 +148,7 @@ int fec_initialize(bd_t *bis)
/* for FEC1 make sure that the name of the interface is the same
as the old one for compatibility reasons */
if (i == 0) {
sprintf (dev->name, "FEC");
strcpy(dev->name, "FEC");
} else {
sprintf (dev->name, "FEC%d",
ether_fcc_info[i].ether_index + 1);

View File

@@ -77,7 +77,7 @@ int scc_initialize(bd_t *bis)
dev = (struct eth_device*) malloc(sizeof *dev);
memset(dev, 0, sizeof *dev);
sprintf(dev->name, "SCC");
strcpy(dev->name, "SCC");
dev->iobase = 0;
dev->priv = 0;
dev->init = scc_init;

View File

@@ -981,11 +981,11 @@ static void *video_logo (void)
U_BOOT_VERSION, U_BOOT_DATE, U_BOOT_TIME);
video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y, info);
sprintf (info, "(C) 2002 DENX Software Engineering");
strcpy(info, "(C) 2002 DENX Software Engineering");
video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT,
info);
sprintf (info, " Wolfgang DENK, wd@denx.de");
strcpy(info, " Wolfgang DENK, wd@denx.de");
video_drawstring (VIDEO_INFO_X, VIDEO_INFO_Y + VIDEO_FONT_HEIGHT * 2,
info);