1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-23 21:43:51 +01:00
Marian Buschsieweke 7a738d0e0b
sys/net/nanocoap: fix buffer overflow in separate response handling
When RFC 8974 support (module `nanocoap_token_ext`) is in use, the
request token may be longer than the buffer in the separate response
context is large. This adds a check to not overflow the buffer.

Sadly, this is an API change: Preparing the separate response context
can actually fail, so we need to report this with a return value.

The example application has been adapted to only proceed if the separate
reply context could have been prepared, and rather directly emit a
reset message if the token exceeds the static buffer.

Co-authored-by: benpicco <benpicco@googlemail.com>
2024-12-12 14:28:28 +01:00

62 lines
1.7 KiB
Makefile

include ../Makefile.net_common
# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += netdev_default
USEMODULE += auto_init_gnrc_netif
# Specify the mandatory networking modules
USEMODULE += gnrc_ipv6_default
# Optionally include DNS support. This includes resolution of names at an
# upstream DNS server and the handling of RDNSS options in Router Advertisements
# to auto-configure that upstream DNS server.
# USEMODULE += sock_dns # include DNS client
# USEMODULE += gnrc_ipv6_nib_dns # include RDNSS option handling
USEMODULE += nanocoap_sock
USEMODULE += nanocoap_resources
USEMODULE += fmt # scn_buf_hex() for shell cmd client_token
# boards where basic nanocoap functionality fits, but no VFS
LOW_MEMORY_BOARDS := \
atmega1284p \
atxmega-a3bu-xplained \
blackpill-stm32f103c8 \
bluepill-stm32f103c8 \
derfmega128 \
im880b \
nucleo-f302r8 \
saml10-xpro \
saml11-xpro \
sipeed-longan-nano \
sipeed-longan-nano-tft \
spark-core \
stm32f7508-dk \
stm32mp157c-dk2 \
#
# Don't enable VFS, DTLS functions on small boards
ifeq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
USEMODULE += nanocoap_dtls
USEMODULE += prng_sha256prng
USEMODULE += nanocoap_vfs
USEMODULE += vfs_default
# USEMODULE += vfs_auto_format
USEMODULE += shell_cmds_default
# DTLS and VFS operations require more stack on the main thread
CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\)
# always enable auto-format for native
ifneq (,$(filter native native64,$(BOARD)))
USEMODULE += vfs_auto_format
endif
endif
# Required by test
USEMODULE += od
USEMODULE += shell
include $(RIOTBASE)/Makefile.include