MXS-3054: Fix crash on malformed mapping reply
The code used a null GWBUF with gwbuf_append which causes a crash. The return value of the function that used it was also not correctly handled and would be mistaken for a different error.
This commit is contained in:
@ -1024,6 +1024,10 @@ int SchemaRouterSession::inspect_mapping_states(SSRBackend& bref,
|
|||||||
(*it)->backend()->server->name(),
|
(*it)->backend()->server->name(),
|
||||||
m_client->session);
|
m_client->session);
|
||||||
}
|
}
|
||||||
|
else if (rc == SHOWDB_FATAL_ERROR)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mxb_assert(rc != SHOWDB_PARTIAL_RESPONSE);
|
mxb_assert(rc != SHOWDB_PARTIAL_RESPONSE);
|
||||||
@ -1279,7 +1283,7 @@ enum showdb_response SchemaRouterSession::parse_mapping_response(SSRBackend& bre
|
|||||||
if (ptr >= (uint8_t*) buf->end)
|
if (ptr >= (uint8_t*) buf->end)
|
||||||
{
|
{
|
||||||
MXS_INFO("Malformed packet for mapping query.");
|
MXS_INFO("Malformed packet for mapping query.");
|
||||||
*buffer = gwbuf_append(buf, *buffer);
|
gwbuf_free(buf);
|
||||||
return SHOWDB_FATAL_ERROR;
|
return SHOWDB_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user