mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-26. Intermediary commit.
Fix binlog_gtid_pos() to handle empty file name, and to not allow user to open arbitrary file on the system.
This commit is contained in:
@ -957,13 +957,28 @@ end:
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
gtid_state_from_binlog_pos(const char *name, uint32 pos, String *out_str)
|
gtid_state_from_binlog_pos(const char *in_name, uint32 pos, String *out_str)
|
||||||
{
|
{
|
||||||
slave_connection_state gtid_state;
|
slave_connection_state gtid_state;
|
||||||
|
const char *lookup_name;
|
||||||
|
char name_buf[FN_REFLEN];
|
||||||
|
LOG_INFO linfo;
|
||||||
|
|
||||||
|
if (in_name && in_name[0])
|
||||||
|
{
|
||||||
|
mysql_bin_log.make_log_name(name_buf, in_name);
|
||||||
|
lookup_name= name_buf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
lookup_name= NULL;
|
||||||
|
linfo.index_file_offset= 0;
|
||||||
|
if (mysql_bin_log.find_log_pos(&linfo, lookup_name, 1))
|
||||||
|
return 1;
|
||||||
|
|
||||||
if (pos < 4)
|
if (pos < 4)
|
||||||
pos= 4;
|
pos= 4;
|
||||||
if (gtid_state_from_pos(name, pos, >id_state) ||
|
|
||||||
|
if (gtid_state_from_pos(linfo.log_file_name, pos, >id_state) ||
|
||||||
gtid_state.to_string(out_str))
|
gtid_state.to_string(out_str))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user