From c007638c1abc4b0876b94953e1f0a652dc24faa3 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Mon, 4 Feb 2013 11:01:13 +0100 Subject: [PATCH] fixed bug in size-calculation of coap_new_error_response() (applied patch from Thomas Stammeier) The calculation of required space for textual error phrase did not take into account the one byte for the payload start marker. --- net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net.c b/net.c index 3b76e2e7..b8f89f6c 100644 --- a/net.c +++ b/net.c @@ -775,9 +775,9 @@ coap_new_error_response(coap_pdu_t *request, unsigned char code, #if COAP_ERROR_PHRASE_LENGTH > 0 char *phrase = coap_response_phrase(code); - /* Need some more space for the error phrase */ + /* Need some more space for the error phrase and payload start marker */ if (phrase) - size += strlen(phrase); + size += strlen(phrase) + 1; #endif assert(request);