From c7a4d26b387a598b1c7973b205229dfa4d32e93e Mon Sep 17 00:00:00 2001 From: Cory Van Beek Date: Tue, 15 Jul 2025 07:00:55 -0600 Subject: [PATCH] Fix dereference before NULL check (#585) You are right, thank you. --- 301/CO_HBconsumer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/301/CO_HBconsumer.c b/301/CO_HBconsumer.c index 1c361db..3430dfa 100644 --- a/301/CO_HBconsumer.c +++ b/301/CO_HBconsumer.c @@ -75,7 +75,10 @@ static CO_ReturnError_t CO_HBconsumer_initEntry(CO_HBconsumer_t* HBcons, uint8_t */ static ODR_t OD_write_1016(OD_stream_t* stream, const void* buf, OD_size_t count, OD_size_t* countWritten) { - CO_HBconsumer_t* HBcons = stream->object; + CO_HBconsumer_t* HBcons; + if (stream != NULL) { + HBcons = stream->object; + } if ((stream == NULL) || (buf == NULL) || (stream->subIndex < 1U) || (stream->subIndex > HBcons->numberOfMonitoredNodes) || (count != sizeof(uint32_t))