coap_ws.c: Unmask server data on oversize header reads

This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2023-07-26 08:12:31 +01:00
1 parent 46f3d82400
commit f809315bbc
1 file changed
+4
+4
View File
@@ -741,6 +741,10 @@ coap_ws_read(coap_session_t *session, uint8_t *data, size_t datalen) {
/* more information in header than given data size */
memcpy(data, &session->ws->rd_header[2 + extra_hdr_len], bytes_size);
session->ws->data_ofs = bytes_size;
if (session->ws->state == COAP_SESSION_TYPE_SERVER) {
/* Need to unmask the data */
coap_ws_mask_data(session, data, bytes_size);
}
/* set up partial header for the next read */
memmove(session->ws->rd_header,
&session->ws->rd_header[2 + extra_hdr_len + bytes_size],