You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix table map event processing
The table name is also null-terminated so the length plus one byte needs to be skipped. If the table map event is not used immediately after the event is read, the column types would point to possibly freed memory. To avoid this, memory should be allocated for it.
This commit is contained in:
@@ -246,8 +246,10 @@ MARIADB_RPL_EVENT * STDCALL mariadb_rpl_fetch(MARIADB_RPL *rpl, MARIADB_RPL_EVEN
|
||||
goto mem_error;
|
||||
ev+= len + 1;
|
||||
rpl_event->event.table_map.column_count= mysql_net_field_length(&ev);
|
||||
rpl_event->event.table_map.column_types= (char *)ev;
|
||||
ev+= rpl_event->event.table_map.column_count;
|
||||
len= rpl_event->event.table_map.column_count;
|
||||
if (rpl_alloc_string(rpl_event, &rpl_event->event.table_map.column_types, ev, len))
|
||||
goto mem_error;
|
||||
ev+= len;
|
||||
len= mysql_net_field_length(&ev);
|
||||
if (rpl_alloc_string(rpl_event, &rpl_event->event.table_map.metadata, ev, len))
|
||||
goto mem_error;
|
||||
|
Reference in New Issue
Block a user