Fix out of bounds read in avro_client_process_command
When the last transaction was queried, it caused an out of bounds read when strstr was used on the raw data of a GWBUF.
This commit is contained in:
@ -448,7 +448,10 @@ avro_client_process_command(AVRO_INSTANCE *router, AVRO_CLIENT *client, GWBUF *q
|
|||||||
const char req_last_gtid[] = "QUERY-LAST-TRANSACTION";
|
const char req_last_gtid[] = "QUERY-LAST-TRANSACTION";
|
||||||
const char req_gtid[] = "QUERY-TRANSACTION";
|
const char req_gtid[] = "QUERY-TRANSACTION";
|
||||||
const size_t req_data_len = sizeof(req_data) - 1;
|
const size_t req_data_len = sizeof(req_data) - 1;
|
||||||
uint8_t *data = GWBUF_DATA(queue);
|
size_t buflen = gwbuf_length(queue);
|
||||||
|
uint8_t data[buflen + 1];
|
||||||
|
gwbuf_copy_data(queue, 0, buflen, data);
|
||||||
|
data[buflen] = '\0';
|
||||||
char *command_ptr = strstr((char *)data, req_data);
|
char *command_ptr = strstr((char *)data, req_data);
|
||||||
|
|
||||||
if (command_ptr != NULL)
|
if (command_ptr != NULL)
|
||||||
|
Reference in New Issue
Block a user