Commit d98e2ea9 authored by unknown's avatar unknown

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.
parent 041f26d3
...@@ -957,13 +957,28 @@ end: ...@@ -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, &gtid_state) ||
if (gtid_state_from_pos(linfo.log_file_name, pos, &gtid_state) ||
gtid_state.to_string(out_str)) gtid_state.to_string(out_str))
return 1; return 1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment