summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-07-23 12:14:15 +0300
committerStefan Roese <sr@denx.de>2021-07-31 10:49:31 +0300
commita18ae18a59615b1e7ff82bcf2d5740e2adbf6165 (patch)
treee64b30e6ef7c0c075480f337e4614016aa262425 /tools
parenta107c61b4180fb5bfe7d0044a25d6db829b8b00f (diff)
downloadu-boot-a18ae18a59615b1e7ff82bcf2d5740e2adbf6165.tar.xz
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/kwbimage.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index f3b16d94ad..5410df63f5 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1867,7 +1867,7 @@ static int kwbimage_generate(struct image_tool_params *params,
*/
static int kwbimage_check_params(struct image_tool_params *params)
{
- if (!strlen(params->imagename)) {
+ if (!params->imagename || !strlen(params->imagename)) {
char *msg = "Configuration file for kwbimage creation omitted";
fprintf(stderr, "Error:%s - %s\n", params->cmdname, msg);