summaryrefslogtreecommitdiffstats
path: root/common/imd.c
diff options
context:
space:
mode:
authorHubert Feurstein <h.feurstein@gmail.com>2020-09-04 12:10:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-09-14 12:19:45 +0200
commitf2ec4cf3bca6f6fc5cc5d5f34544f7edf3835b3c (patch)
treeff24f14b1e135d9a95dc10e0935637adddf8f30c /common/imd.c
parentc6d2ab432d054976e233dc93734e362f0a1ab173 (diff)
downloadbarebox-f2ec4cf3bca6f6fc5cc5d5f34544f7edf3835b3c.tar.gz
barebox-f2ec4cf3bca6f6fc5cc5d5f34544f7edf3835b3c.tar.xz
imd: imd_calculate_crc32: initialize imd_crc to NULL
This fixes a dereference of an uninitialized pointer when imd-crc-token is not found. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/imd.c')
-rw-r--r--common/imd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/common/imd.c b/common/imd.c
index 96496514a5..0644e6d3bf 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -312,6 +312,7 @@ static int imd_calculate_crc32(void *input, const struct imd_header *imd_start,
const struct imd_header *imd;
int length;
int end_ofs = (char *)imd_start - (char *)input + sizeof(char) * 8;
+ *imd_crc = NULL;
/* search the checksum imd token */
imd_for_each(imd_start, imd) {