1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net
Marian Buschsieweke 835571c0a7
sys/net/nanocoap: fix UB when building hdr
Some calls to `coap_build_hdr()` were done with the target buffer for
the header and the source buffer for the token overlapping:
They reuse the buffer that held the request to assemble the response in.
We cannot use `memcpy()` in this case to copy the token into the target
buffer, as source and destination would (fully) overlap.

This commit makes reusing the request buffer for the response a special
case: `memcpy()` is only used to copy the token if source and
destination address of the token differ.

An alternative fix would have been to use `memmove()` unconditionally.
But `memmove()` does not make any assumption about the layout of target
and source buffer, while we know that the token either will already be
at the right position (when reusing the request buffer for the response)
or be in a non-overlapping buffer (when generating a fresh token). This
approach is more efficient than `memmove()`.
2024-10-17 14:02:06 +02:00
..
application_layer sys/net/nanocoap: fix UB when building hdr 2024-10-17 14:02:06 +02:00
ble bluetil: Ensure advertisement length does not exceed pkt len 2024-10-01 14:49:09 +02:00
credman *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
crosslayer *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dsm sys/net/dsm: add missing dependencies 2022-02-21 15:15:02 +01:00
gnrc Merge pull request #20834 from derMihai/mir/nib/drop_for_unreachable_rebase 2024-10-16 09:16:40 +00:00
link_layer *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lora *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
netdev_test netdev_test: avoid explicit cast to netdev 2021-07-09 11:35:19 +02:00
netif *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
netstats sys/include/net/netstats: move xtimer header where it is needed 2021-02-16 18:18:21 +01:00
netutils net/util: make use of dns_query() 2022-07-29 17:48:26 +02:00
network_layer *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sock *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
transport_layer sys: fix doxygen grouping 2018-06-11 19:12:02 +02:00
doc.txt doc: add net to sys group 2015-08-30 14:00:33 +02:00
ieee802154.txt doc: Link to thread primer 2024-02-14 17:44:13 +01:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00