tools: dumpimage: Fix crashing when trying to extract data from kwbimage
authorPali Rohár <pali@kernel.org>
Fri, 23 Jul 2021 09:14:15 +0000 (11:14 +0200)
committerStefan Roese <sr@denx.de>
Sat, 31 Jul 2021 07:49:31 +0000 (09:49 +0200)
commita18ae18a59615b1e7ff82bcf2d5740e2adbf6165
treee64b30e6ef7c0c075480f337e4614016aa262425
parenta107c61b4180fb5bfe7d0044a25d6db829b8b00f
tools: dumpimage: Fix crashing when trying to extract data from kwbimage

Trying to call the following command causes NULL pointer dereference in
strlen():
  ./tools/dumpimage -T kwbimage -o /tmp/out u-boot-spl.kwb

Fix it by checking whether params->imagename is non-NULL before calling
strlen().

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwbimage.c