From e35bcb6853609302c31e8199bd72ef348b7459b4 Mon Sep 17 00:00:00 2001 From: Ken Bannister Date: Wed, 23 Jan 2019 16:19:47 -0500 Subject: [PATCH] net/nanocoap: fix remaining space calculation The space calculation must use the same length as the eventual return value. --- sys/net/application_layer/nanocoap/nanocoap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/application_layer/nanocoap/nanocoap.c b/sys/net/application_layer/nanocoap/nanocoap.c index 455ebfe7e2..cb7b2e30da 100644 --- a/sys/net/application_layer/nanocoap/nanocoap.c +++ b/sys/net/application_layer/nanocoap/nanocoap.c @@ -364,7 +364,7 @@ ssize_t coap_build_reply(coap_pkt_t *pkt, unsigned code, unsigned tkl = coap_get_token_len(pkt); unsigned len = sizeof(coap_hdr_t) + tkl; - if ((len + payload_len + 1) > rlen) { + if ((len + payload_len) > rlen) { return -ENOSPC; }