diff --git a/src/coap_ws.c b/src/coap_ws.c index 3b90a152..d1d31616 100644 --- a/src/coap_ws.c +++ b/src/coap_ws.c @@ -498,7 +498,7 @@ coap_ws_rd_http_header(coap_session_t *session) { * some frame info that needs to be subsequently processed */ rem = ws->http_ofs > (sizeof(ws->http_hdr) - 1 - COAP_MAX_FS) ? - sizeof(ws->http_hdr) - ws->http_ofs : COAP_MAX_FS; + sizeof(ws->http_hdr) - ws->http_ofs -1 : COAP_MAX_FS; bytes = session->sock.lfunc[COAP_LAYER_WS].l_read(session, &ws->http_hdr[ws->http_ofs], rem);