mkimage: Fix missing free() in show_valid_options()
PATCH v2 1/2 mkimage: Fix missing free() in show_valid_options()
The allocated memory should be freed. Fix it.
Signed-off-by Simon Glass <[email protected]>
Reported-by Coverity (CID: 150963)
Reviewed-by Tom Rini <[email protected]>
---
Changes in v2: None
tools/mkimage.c | 1 + 1 file changed, 1 insertion(+)
tools/mkimage.c +1 -0
@@ -64,6 +64,7 @@ static int show_valid_options(enum ih_category category) genimg_get_cat_name(category, item)); }fprintf (stderr,"\n" ); +free (order);return 0 ; }
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 2/2 image: Protect against overflow in unknown_msg()
Coverity complains that this can overflow. If we later increase the size of one of the strings in the table, it could happen.
Adjust the code to protect against this.
Signed-off-by Simon Glass <[email protected]>
Reported-by Coverity (CID: 150964)
---
Changes in v2:
- Drop unwanted #include
common/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/image.c +1 -1
@@ -590,7 +590,7 @@ static const char *unknown_msg(enum ih_category category)static char msg[30 ];strcpy (msg,"Unknown " ); -strcat (msg, table_info[category].desc); +strncat (msg, table_info[category].desc,sizeof (msg) -1 );return msg; }
Signature · 1 line
2.8.0.rc3.226.g39d4020
PATCH v2 1/2 mkimage: Fix missing free() in show_valid_options()
In reply to Simon GlassQuoted 5 lines · Simon Glass
The allocated memory should be freed. Fix it.
Signed-off-by Simon Glass <[email protected]>Reported-by Coverity (CID: 150963)Reviewed-by Tom Rini <[email protected]>
Applied to u-boot/master (before v2016.11-rc3), thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161102/fcba2547/attachment.sig>