Skip to content

Commit

Permalink
mkimage: error handling for FIT image
Browse files Browse the repository at this point in the history
If parameter -F is given but FIT support is missing, a NULL pointer might
dereferenced (Coverity CID 350249).

If incorrect parameters are given, provide a message and show usage.

Signed-off-by: Heinrich Schuchardt <[email protected]>
  • Loading branch information
xypron authored and trini committed Mar 4, 2022
1 parent 55fd1c4 commit 5017f9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/mkimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,11 @@ int main(int argc, char **argv)
}

if (params.fflag){
if (!tparams) {
fprintf(stderr, "%s: Missing FIT support\n",
params.cmdname);
exit (EXIT_FAILURE);
}
if (tparams->fflag_handle)
/*
* in some cases, some additional processing needs
Expand All @@ -391,7 +396,7 @@ int main(int argc, char **argv)
retval = tparams->fflag_handle(&params);

if (retval != EXIT_SUCCESS)
exit (retval);
usage("Bad parameters for FIT image type");
}

if (params.lflag || params.fflag) {
Expand Down

0 comments on commit 5017f9b

Please sign in to comment.