Skip to content

Commit

Permalink
client.c: set connect attributes as late as possible
Browse files Browse the repository at this point in the history
just before they're sent to the client. Because mysql->host
value is known only after the connection is established,
and it's needed for the "_sever_host" attribute.

This fixes ASAN use-after-free warning in rpl tests

followup for ee8dfc6
  • Loading branch information
vuvova committed Jun 3, 2018
1 parent 748ef3e commit eb76698
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions sql-common/client.c
Expand Up @@ -3123,9 +3123,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
DBUG_RETURN(0);
}

if (set_connect_attributes(mysql, buff, sizeof(buff)))
DBUG_RETURN(0);

mysql->methods= &client_methods;
mysql->client_flag=0; /* For handshake */

Expand Down Expand Up @@ -3579,6 +3576,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,

mysql->client_flag= client_flag;

set_connect_attributes(mysql, buff, sizeof(buff));

/*
Part 2: invoke the plugin to send the authentication data to the server
*/
Expand Down

0 comments on commit eb76698

Please sign in to comment.