From d037f626fabf680946888a3fa3a3d0447eb0708d Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Fri, 14 Jan 2011 17:48:11 +0200 Subject: [PATCH] Bug #59453: Non-ASCIIZ string kills protocol extensibility in MySQL 5.5 When the server sends the name of the plugin it's using in the handshake packet it was null terminating it in it's buffer, but was sending a length of the packet 1 byte short. Fixed to send the terminating 0 as well by increasing the length of the packet to include it. In this way the handshake packet becomes similar to the change user packet where the plugin name is null terminated. No test suite added as the fix can only be observed by analyzing the bytes sent over the wire. --- sql/sql_acl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 5ac31d1f578..427e2eb7346 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -8014,7 +8014,7 @@ static bool send_server_handshake_packet(MPVIO_EXT *mpvio, end= strmake(end, plugin_name(mpvio->plugin)->str, plugin_name(mpvio->plugin)->length); - int res= my_net_write(mpvio->net, (uchar*) buff, (size_t) (end - buff)) || + int res= my_net_write(mpvio->net, (uchar*) buff, (size_t) (end - buff + 1)) || net_flush(mpvio->net); my_afree(buff); DBUG_RETURN (res);