mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01: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:
parent
041f26d349
commit
d98e2ea9fe
1 changed files with 17 additions and 2 deletions
|
@ -957,13 +957,28 @@ end:
|
|||
|
||||
|
||||
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;
|
||||
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)
|
||||
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))
|
||||
return 1;
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue