Commit e23becc5 authored by unknown's avatar unknown

Security bug: password length check should be in check_user, not check_connections(),

otherwise COM_CHANGE_USER is unprotected and can be used for both privilege escalation and buffer overrun
parent 6c7320ca
...@@ -109,6 +109,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, ...@@ -109,6 +109,8 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
NET *net= &thd->net; NET *net= &thd->net;
thd->db=0; thd->db=0;
if (passwd[0] && strlen(passwd) != SCRAMBLE_LENGTH)
return 1;
if (!(thd->user = my_strdup(user, MYF(0)))) if (!(thd->user = my_strdup(user, MYF(0))))
{ {
send_error(net,ER_OUT_OF_RESOURCES); send_error(net,ER_OUT_OF_RESOURCES);
...@@ -458,8 +460,6 @@ check_connections(THD *thd) ...@@ -458,8 +460,6 @@ check_connections(THD *thd)
char *user= (char*) net->read_pos+5; char *user= (char*) net->read_pos+5;
char *passwd= strend(user)+1; char *passwd= strend(user)+1;
char *db=0; char *db=0;
if (passwd[0] && strlen(passwd) != SCRAMBLE_LENGTH)
return ER_HANDSHAKE_ERROR;
if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB) if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB)
db=strend(passwd)+1; db=strend(passwd)+1;
if (thd->client_capabilities & CLIENT_INTERACTIVE) if (thd->client_capabilities & CLIENT_INTERACTIVE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment