summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-06-02 22:27:59 +0200
committerSergei Golubchik <serg@mariadb.org>2018-06-03 23:25:43 +0200
commiteb76698300c8611eddc2756aa5dbc57cdae2e21d (patch)
tree5fa17c878fc181a2ef0a3185c1e54fcb02478ebc
parent748ef3ec91d35aa6cd5b230c71084f6c83c1c92e (diff)
downloadmariadb-git-eb76698300c8611eddc2756aa5dbc57cdae2e21d.tar.gz
client.c: set connect attributes as late as possible
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 ee8dfc688e8
-rw-r--r--sql-common/client.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 6a44a2db0aa..ad85738b0cb 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -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 */
@@ -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
*/