Skip to contentSkip to conversation

SPL: Limit image name print length

PATCH In review Taras Kondratiuk 2 participants 2 messages Jul 16, 2013 – Aug 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SPL: Limit image name print length

If image name is longer than 32 bytes, then it will be truncated. This will remove '\0' at the end of the line, so printf will go out of string limit.

---
 common/spl/spl.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/spl/spl.c +3 -2
index ff9ba7b..861ca0a 100644
@@ -108,8 +108,9 @@ void spl_parse_image_header(const struct image_header *header)
 		}
 		spl_image.os = image_get_os(header);
 		spl_image.name = image_get_name(header);
-		debug("spl: payload image: %s load addr: 0x%x size: %d\n",
-			spl_image.name, spl_image.load_addr, spl_image.size);
+		debug("spl: payload image: %.*s load addr: 0x%x size: %d\n",
+			sizeof(spl_image.name), spl_image.name,
+			spl_image.load_addr, spl_image.size);
 	} else {
 		/* Signature not found - assume u-boot.bin */
 		debug("mkimage signature not found - ih_magic = %x\n",
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Taras Kondratiuk

If image name is longer than 32 bytes, then it will be truncated. This will remove '\0' at the end of the line, so printf will go out of string limit.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130818/22d1385c/attachment.pgp>