Added protection for buffer overrun in COM_BINLOG_DUMP.
This commit is contained in:
@ -1079,8 +1079,15 @@ uint32_t chksum;
|
|||||||
ptr = GWBUF_DATA(queue);
|
ptr = GWBUF_DATA(queue);
|
||||||
len = extract_field(ptr, 24);
|
len = extract_field(ptr, 24);
|
||||||
binlognamelen = len - 11;
|
binlognamelen = len - 11;
|
||||||
if (! slave->nocrc)
|
if (binlognamelen > BINLOG_FNAMELEN)
|
||||||
binlognamelen -= 4;
|
{
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"blr_slave_binlog_dump truncating binlog filename "
|
||||||
|
"from %d to %d",
|
||||||
|
binlognamelen, BINLOG_FNAMELEN)));
|
||||||
|
binlognamelen = BINLOG_FNAMELEN;
|
||||||
|
}
|
||||||
ptr += 4; // Skip length and sequence number
|
ptr += 4; // Skip length and sequence number
|
||||||
if (*ptr++ != COM_BINLOG_DUMP)
|
if (*ptr++ != COM_BINLOG_DUMP)
|
||||||
{
|
{
|
||||||
@ -1100,6 +1107,13 @@ uint32_t chksum;
|
|||||||
strncpy(slave->binlogfile, (char *)ptr, binlognamelen);
|
strncpy(slave->binlogfile, (char *)ptr, binlognamelen);
|
||||||
slave->binlogfile[binlognamelen] = 0;
|
slave->binlogfile[binlognamelen] = 0;
|
||||||
|
|
||||||
|
LOGIF(LD, (skygw_log_write(
|
||||||
|
LOGFILE_DEBUG,
|
||||||
|
"%s: COM_BINLOG_DUMP: binlog name '%s', length %d, "
|
||||||
|
"from position %d.", router->service->name,
|
||||||
|
slave->binlogfile, binlognamelen,
|
||||||
|
slave->binlog_pos)));
|
||||||
|
|
||||||
slave->seqno = 1;
|
slave->seqno = 1;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user