Describe your changes
Check the buffer length before reading bytes off the buffer.
Testing performed
I added a unit test that exposes the overflow. It fails in an ASAN build without the fix, and succeeds with the fix.
Additional context
This doesn't cause an ASAN failure when sending the bytes to the running server, since the memory region allocated to hold the wire bytes is much larger than what is actually sent by the client. The bytes read though are uninitialized regardless.
Describe your changes Check the buffer length before reading bytes off the buffer.
Testing performed I added a unit test that exposes the overflow. It fails in an ASAN build without the fix, and succeeds with the fix.
Additional context This doesn't cause an ASAN failure when sending the bytes to the running server, since the memory region allocated to hold the wire bytes is much larger than what is actually sent by the client. The bytes read though are uninitialized regardless.