[PATCH v2] tools: mkimage: Fix nullptr at strchr()
Mikhail Ilin
ilin.mikhail.ol at gmail.com
Wed Nov 23 08:10:21 CET 2022
The 'file' pointer can be null. Thus, before using it in the
strchr() function, you need to make sure that it is not null.
Fixes: d1be8f922eb3 ("mkimage: Fix variable length header support")
Signed-off-by: Mikhail Ilin <ilin.mikhail.ol at gmail.com>
---
tools/mkimage.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 5f51d2cc89..95005d8414 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -509,6 +509,8 @@ int main(int argc, char **argv)
file = params.datafile;
for (;;) {
+ if (!file)
+ break;
char *sep = strchr(file, ':');
if (sep) {
*sep = '\0';
--
2.17.1
More information about the U-Boot
mailing list