mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL
@ 2020-09-04 10:10 Hubert Feurstein
  2020-09-04 12:49 ` Hubert Feurstein
  0 siblings, 1 reply; 3+ messages in thread
From: Hubert Feurstein @ 2020-09-04 10:10 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL
  2020-09-04 10:10 [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL Hubert Feurstein
@ 2020-09-04 12:49 ` Hubert Feurstein
  2020-09-14 10:21   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Hubert Feurstein @ 2020-09-04 12:49 UTC (permalink / raw)
  To: barebox

Am Fr., 4. Sept. 2020 um 12:10 Uhr schrieb Hubert Feurstein
<h.feurstein@gmail.com>:
> This fixes a NULL pointer dereference in the caller when imd-crc-token is
> not found.
In fact, it is even worse, it is a "uninitialized pointer dereference".

Regards
Hubert

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL
  2020-09-04 12:49 ` Hubert Feurstein
@ 2020-09-14 10:21   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2020-09-14 10:21 UTC (permalink / raw)
  To: Hubert Feurstein; +Cc: barebox

Hi Hubert,

On Fri, Sep 04, 2020 at 02:49:15PM +0200, Hubert Feurstein wrote:
> Am Fr., 4. Sept. 2020 um 12:10 Uhr schrieb Hubert Feurstein
> <h.feurstein@gmail.com>:
> > This fixes a NULL pointer dereference in the caller when imd-crc-token is
> > not found.
> In fact, it is even worse, it is a "uninitialized pointer dereference".

Applied to master, thanks. I reworded the commit to:

This fixes a dereference of an uninitialized pointer when imd-crc-token
is not found.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-14 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 10:10 [PATCH] imd: imd_calculate_crc32: initialize imd_crc to NULL Hubert Feurstein
2020-09-04 12:49 ` Hubert Feurstein
2020-09-14 10:21   ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox