Dear Maintainer,
When connecting to a server using SASL, memcached_sasl_authenticate_connection() reads the list of
supported mechanisms from the server via the command PROTOCOL_BINARY_CMD_SASL_LIST_MECHS.
The server's response is a string containing supported authentication mechanisms, which gets
stored into the (uninitialized) destination buffer without null termination.
The buffer then gets passed to sasl_client_start which treats it as a null-terminated string,
reading uninitialised bytes in the buffer.
As the buffer lives on the stack, an attacker that can put strings on the stack before the
connection gets made, might be able to tamper with the authentication [1].
[1] : https://bugs.launchpad.net/ubuntu/+source/libmemcached/+bug/1573594
In Ubuntu, the attached patch was applied to achieve the following:
* Fix missing null termination in PROTOCOL_BINARY_CMD_SASL_LIST_MECHS
response handling (LP: #1573594)
Thanks for considering the patch.