1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00
RIOT/sys/net/application_layer/nanocoap
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
..
cache.c Merge pull request #20043 from bergzand/pr/nanocoap_cache_options 2024-02-13 15:23:59 +00:00
fileserver.c nanocoap_fileserver: add support for size2 option 2024-05-22 20:16:25 +02:00
fs.c nanocoap_fs: add nanoCoAP as VFS backend 2024-05-29 11:32:22 +02:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
link_format.c nanocoap_link_format: don't drop characters in fragmented entries 2024-05-07 22:45:37 +02:00
Makefile sys/net/nanocoap: use submodules 2017-12-01 12:55:45 +01:00
Makefile.include sys/net/nanocoap: ensure DTLS buffer is at least 200 bytes 2024-04-03 21:09:29 +02:00
nanocoap.c sys/net/nanocoap: fix UB when building hdr 2024-10-17 14:02:06 +02:00
sock.c sys/net/application_layer/nanocoap: add nanocoap_sock_get_non 2024-09-10 16:43:44 +02:00
vfs.c nanocoap: homogenize name of the module 2023-06-08 16:29:12 +02:00