[U-Boot] [PATCH] 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.
Signed-off-by: Taras Kondratiuk taras@ti.com Reviewed-by: Tom Rini trini@ti.com --- common/spl/spl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c index ff9ba7b..861ca0a 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -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",

On Tue, Jul 16, 2013 at 02:45:01PM +0300, Taras Kondratiuk wrote:
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.
Signed-off-by: Taras Kondratiuk taras@ti.com Reviewed-by: Tom Rini trini@ti.com
Applied to u-boot/master, thanks!
participants (2)
-
Taras Kondratiuk
-
Tom Rini