bloomberg / amqpprox

An AMQP 0.9.1 proxy server, designed for use in front of an AMQP 0.9.1 compliant message queue broker such as RabbitMQ.
Apache License 2.0
78 stars 16 forks source link

Check length of buffer #106

Closed ccotter closed 5 months ago

ccotter commented 5 months ago

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.