check max frame size (#119)

This commit is contained in:
Benjamin Sergeant 2019-10-28 21:53:31 -07:00 committed by GitHub
parent ebb31b4e87
commit c943e72c7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -542,6 +542,13 @@ namespace ix
ws.masking_key[3] = 0; ws.masking_key[3] = 0;
} }
// Prevent integer overflow in the next conditional
const uint64_t maxFrameSize(1 << 63);
if (ws.N > maxFrameSize)
{
return;
}
if (_rxbuf.size() < ws.header_size + ws.N) if (_rxbuf.size() < ws.header_size + ws.N)
{ {
return; /* Need: ws.header_size+ws.N - _rxbuf.size() */ return; /* Need: ws.header_size+ws.N - _rxbuf.size() */