zephyr/tests/subsys/zbus
Jan Tore Guggedal a7ce6055b7 zbus: Fix NULL pointer use in zbus_chan_rm_obs()
Fix a bug in zbus_chan_rm_obs() where removing the first observer in a
channel's observer list would cause undefined behavior due to accessing
a member of a NULL pointer.

The issue occurred when prev_obs_nd was NULL (indicating the first node
in the list) and the code attempted to pass &prev_obs_nd->node to
sys_slist_remove(). This resulted in accessing the 'node' member of a
NULL pointer, which is undefined behavior even when taking its address.

The sys_slist_remove() function is designed to handle a NULL prev_node
parameter correctly for removing the first element in a list. The fix
ensures we pass NULL directly instead of attempting to compute the
address of a member within a NULL pointer.

This was detected by Undefined Behavior Sanitizer as "member access
within null pointer".

Signed-off-by: Jan Tore Guggedal <jantore.guggedal@nordicsemi.no>
2025-07-04 15:49:32 -05:00
..
channel_id
dyn_channel
hlp_priority_boost tests: subsys: Fix zassert string 2025-05-22 16:17:23 +02:00
integration test: zbus: Disable icount shift on qemu_rx 2025-06-26 14:07:03 +02:00
publish_stats
runtime_observers_registration zbus: Fix NULL pointer use in zbus_chan_rm_obs() 2025-07-04 15:49:32 -05:00
runtime_observers_registration_alloc_none zbus: Fix NULL pointer use in zbus_chan_rm_obs() 2025-07-04 15:49:32 -05:00
unittests tests: subsys: Fix zassert string 2025-05-22 16:17:23 +02:00
user_data tests: subsys: Fix zassert string 2025-05-22 16:17:23 +02:00