mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Hubert Feurstein <h.feurstein@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL
Date: Fri,  4 Sep 2020 12:10:40 +0200	[thread overview]
Message-ID: <20200904101040.19043-1-hubert.feurstein@vahle.at> (raw)

From: Hubert Feurstein <h.feurstein@gmail.com>

This fixes a NULL pointer dereference in the caller when imd-crc-token is
not found.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
---
 common/imd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/imd.c b/common/imd.c
index 96496514a..0644e6d3b 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) {
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2020-09-04 10:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04 10:10 Hubert Feurstein [this message]
2020-09-04 12:49 ` Hubert Feurstein
2020-09-14 10:21   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200904101040.19043-1-hubert.feurstein@vahle.at \
    --to=h.feurstein@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox