Skip to content

Commit

Permalink
Fix fuzzing issues regarding masking
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Jan 3, 2022
1 parent 0c8be4d commit 5df695e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/WebSocketProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,12 @@ struct WIN32_EXPORT WebSocketProtocol {
/* No need to unmask if mask is 0 */
uint32_t nullmask = 0;
if (!memcmp(wState->mask, &nullmask, sizeof(uint32_t))) {
unmaskAll(src, wState->mask);
if /*constexpr*/ (LIBUS_RECV_BUFFER_LENGTH == length) {
unmaskAll(src, wState->mask);
} else {
// Slow path
unmaskInplace(src, src + ((length >> 2) + 1) * 4, wState->mask);
}
}
}

Expand Down

0 comments on commit 5df695e

Please sign in to comment.