[tcp_transport] Bugfix: Remove unecessary mask_key check

- In the processing of WS payload the check for a valid mask_key was
  made by checking for a valid address. The address is always valid and
  the test is meaningless.
- Mask key is initialized in the process of header reading and set to 0
  in case of mask not set.
This commit is contained in:
Euripedes Rocha
2022-09-27 11:00:37 +02:00
parent 88c0053172
commit 56a54afae9

View File

@@ -363,10 +363,8 @@ static int ws_read_payload(esp_transport_handle_t t, char *buffer, int len, int
}
ws->frame_state.bytes_remaining -= rlen;
if (ws->frame_state.mask_key) {
for (int i = 0; i < bytes_to_read; i++) {
buffer[i] = (buffer[i] ^ ws->frame_state.mask_key[i % 4]);
}
for (int i = 0; i < bytes_to_read; i++) {
buffer[i] = (buffer[i] ^ ws->frame_state.mask_key[i % 4]);
}
return rlen;
}