Added checks for possible NULL value and out-of-bounds reads.
This commit is contained in:
@ -1633,7 +1633,13 @@ static GWBUF* process_response_data (
|
|||||||
{
|
{
|
||||||
uint8_t* data;
|
uint8_t* data;
|
||||||
|
|
||||||
/** Read next packet length */
|
/** Read next packet length if there is at least
|
||||||
|
* three bytes left. If there is less than three
|
||||||
|
* bytes in the buffer or it is NULL, we need to
|
||||||
|
wait for more data from the backend server.*/
|
||||||
|
if(readbuf == NULL || GWBUF_LENGTH(readbuf) < 3)
|
||||||
|
break;
|
||||||
|
|
||||||
data = GWBUF_DATA(readbuf);
|
data = GWBUF_DATA(readbuf);
|
||||||
nbytes_left = MYSQL_GET_PACKET_LEN(data)+MYSQL_HEADER_LEN;
|
nbytes_left = MYSQL_GET_PACKET_LEN(data)+MYSQL_HEADER_LEN;
|
||||||
/** Store new status to protocol structure */
|
/** Store new status to protocol structure */
|
||||||
|
Reference in New Issue
Block a user