Merge branch '2.1' into 2.2
This commit is contained in:
@ -588,11 +588,16 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
|
||||
const char* username = (const char*)data + MYSQL_AUTH_PACKET_BASE_SIZE;
|
||||
int userlen = get_zstr_len(username, len - MYSQL_AUTH_PACKET_BASE_SIZE);
|
||||
|
||||
if (userlen != -1 && (int)sizeof(ses->user) > userlen)
|
||||
if (userlen != -1)
|
||||
{
|
||||
if ((int)sizeof(ses->user) > userlen)
|
||||
{
|
||||
strcpy(ses->user, username);
|
||||
}
|
||||
|
||||
// Include the null terminator in the user length
|
||||
userlen++;
|
||||
|
||||
if (proto->client_capabilities & GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB)
|
||||
{
|
||||
/** Client is connecting with a default database */
|
||||
@ -603,7 +608,7 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
|
||||
{
|
||||
int dblen = get_zstr_len((const char*)data + dboffset, len - dboffset);
|
||||
|
||||
if (dblen != -1 && (int)sizeof(ses->db) < dblen)
|
||||
if (dblen != -1 && (int)sizeof(ses->db) > dblen)
|
||||
{
|
||||
strcpy(ses->db, (const char*)data + dboffset);
|
||||
}
|
||||
@ -611,6 +616,7 @@ static void store_client_information(DCB *dcb, GWBUF *buffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Debug check function for authentication packets
|
||||
|
||||
Reference in New Issue
Block a user