1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/net/application_layer
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
..
asymcute treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
cord treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
dhcpv6 net/dhcpv6: Improve option parsing in dhcpv6 advertise 2024-10-02 09:47:22 +02:00
dns dns_msg: rename addrlen -> rdlen 2024-09-12 11:00:41 +02:00
emcute *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
gcoap sys/net/gcoap_forward_proxy: fix compilation issues 2024-10-14 14:30:20 +02:00
nanocoap sys/net/nanocoap: fix UB when building hdr 2024-10-17 14:02:06 +02:00
sntp sys/*: realign ENABLE_DEBUG 2020-10-23 11:27:48 +02:00
sock_dns sock_dns: add debug output 2024-09-12 11:00:41 +02:00
sock_dns_mock sys/net/application_layer/sock_dns_mock: add module for mocking sock_dns 2022-04-03 17:29:10 +02:00
sock_dodtls *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
telnet treewide: remove THREAD_CREATE_STACKTEST from thread creation 2024-07-29 11:45:58 +02:00
uhcp net/uhcp: convert to ztimer 2022-03-31 12:50:31 +02:00
doc.txt net/emcute : Update documentation 2020-11-19 23:11:21 +01:00
Kconfig sock_dodtls: Initial import of a DNS over DTLS client 2022-07-26 19:37:12 +02:00
Kconfig.coap *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00