From ae9429fc2063d64cd12c329f290458b5267cfa04 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 13 Nov 2020 09:25:20 +0100 Subject: [PATCH] coap_debug.c: Check value of COAP_DEBUG_BUF_SIZE The technical lower bound of COAP_DEBUG_BUF_SIZE in the code is 5. Sensible values should be significantly larger than 32 to ensure that information can be displayed through this buffer. --- src/coap_debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coap_debug.c b/src/coap_debug.c index 0a07122c..176f0610 100644 --- a/src/coap_debug.c +++ b/src/coap_debug.c @@ -473,6 +473,10 @@ is_binary(int content_format) { * */ +#if COAP_DEBUG_BUF_SIZE < 5 +#error "COAP_DEBUG_BUF_SIZE must be at least 5, should be >= 32 to be useful" +#endif /* COAP_DEBUG_BUF_SIZE < 5 */ + void coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu) { #if COAP_CONSTRAINED_STACK