Skip to content

Commit 989124d

Browse files
Fix 203 (#204)
* Fix #203 * Update the changelog
1 parent f85103b commit 989124d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ If you find the examples to be unclear or incorrect, please, open a ticket.
240240
`CANARD_UAVCAN_SPECIFICATION_VERSION_MAJOR` -> `CANARD_CYPHAL_SPECIFICATION_VERSION_MAJOR`
241241
`CANARD_UAVCAN_SPECIFICATION_VERSION_MINOR` -> `CANARD_CYPHAL_SPECIFICATION_VERSION_MINOR`
242242
243+
#### v3.0.1
244+
245+
- Remove UB as described in [203](https://github.com/OpenCyphal/libcanard/issues/203).
246+
243247
### v2.0
244248
245249
- Dedicated transmission queues per redundant CAN interface with depth limits.

libcanard/canard.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,9 @@ CANARD_PRIVATE TxChain txGenerateMultiFrameChain(CanardInstance* const ins,
410410
}
411411
else
412412
{
413-
out.tail->base.next_in_transfer = &tqi->base;
413+
// C std, 6.7.2.1.15: A pointer to a structure object <...> points to its initial member, and vice versa.
414+
// Can't just read tqi->base because tqi may be NULL; https://github.com/OpenCyphal/libcanard/issues/203.
415+
out.tail->base.next_in_transfer = (CanardTxQueueItem*) tqi;
414416
}
415417
out.tail = tqi;
416418
if (NULL == out.tail)

0 commit comments

Comments
 (0)