Skip to content

Commit

Permalink
coap_ws.c: Unmask server data on oversize header reads
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdeep1 committed Jul 26, 2023
1 parent 46f3d82 commit f809315
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/coap_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down

0 comments on commit f809315

Please sign in to comment.