[PATCH] tools: mkimage: Fix nullptr at strchr() The 'file' pointer can be null. Thus, before using it in the strchr() function, you need to make sure that it is not null.

Simon Glass sjg at chromium.org
Wed Nov 23 03:09:04 CET 2022


Hi,

On Tue, 22 Nov 2022 at 01:32, Mikhail Ilin <ilin.mikhail.ol at gmail.com> wrote:
>
> Fixes: 0b0c6af38738 ("Prepare v2020.01")
> Signed-off-by: Mikhail Ilin <ilin.mikhail.ol at gmail.com>
> ---
>  tools/mkimage.c | 2 ++
>  1 file changed, 2 insertions(+)

Please can you add a commit message and keep your subject to 50 chars?

For the fixes tag, can you find a commit rather than the merge thing?

>
> 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
>

Regards,
SImon


More information about the U-Boot mailing list