mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 06:30:39 +00:00
tools: kwbimage: Don't crash when binary file name does not contain '/'
In the case when the file name is specified relative to the current working directory, it does not contain '/' character and strrchr() returns NULL. The following strcmp() function then crashes on NULL pointer dereference. 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> Reviewed-by: Chris Packham <judge.packham@gmail.com> Tested-by: Chris Packham <judge.packham@gmail.com>
This commit is contained in:
parent
501a54a29c
commit
4efbf1c327
1 changed files with 1 additions and 1 deletions
|
@ -1277,7 +1277,7 @@ static void *image_create_v1(size_t *imagesz, struct image_tool_params *params,
|
|||
if (e) {
|
||||
char *s = strrchr(e->binary.file, '/');
|
||||
|
||||
if (strcmp(s, "/binary.0") == 0)
|
||||
if (s && strcmp(s, "/binary.0") == 0)
|
||||
main_hdr->destaddr = cpu_to_le32(params->addr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue