Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
1bcba618
Commit
1bcba618
authored
Jun 01, 2010
by
He Zhenxing
Browse files
Options
Browse Files
Download
Plain Diff
BUG#52748 Semi-Sync ACK packet isn't check for length
Check the length and use strncpy to make the code safer.
parents
aa284615
5725d230
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
mysql-test/suite/rpl/t/rpl_semi_sync.test
mysql-test/suite/rpl/t/rpl_semi_sync.test
+4
-0
plugin/semisync/semisync_master.cc
plugin/semisync/semisync_master.cc
+14
-4
No files found.
mysql-test/suite/rpl/t/rpl_semi_sync.test
View file @
1bcba618
...
@@ -602,7 +602,11 @@ source include/stop_slave.inc;
...
@@ -602,7 +602,11 @@ source include/stop_slave.inc;
UNINSTALL
PLUGIN
rpl_semi_sync_slave
;
UNINSTALL
PLUGIN
rpl_semi_sync_slave
;
connection
master
;
connection
master
;
# The dump thread may still be running on the master, and so the following
# UNINSTALL could generate a warning about the plugin is busy.
disable_warnings
;
UNINSTALL
PLUGIN
rpl_semi_sync_master
;
UNINSTALL
PLUGIN
rpl_semi_sync_master
;
enable_warnings
;
connection
slave
;
connection
slave
;
source
include
/
start_slave
.
inc
;
source
include
/
start_slave
.
inc
;
...
...
plugin/semisync/semisync_master.cc
View file @
1bcba618
...
@@ -147,7 +147,8 @@ int ActiveTranx::insert_tranx_node(const char *log_file_name,
...
@@ -147,7 +147,8 @@ int ActiveTranx::insert_tranx_node(const char *log_file_name,
}
}
/* insert the binlog position in the active transaction list. */
/* insert the binlog position in the active transaction list. */
strcpy
(
ins_node
->
log_name_
,
log_file_name
);
strncpy
(
ins_node
->
log_name_
,
log_file_name
,
FN_REFLEN
-
1
);
ins_node
->
log_name_
[
FN_REFLEN
-
1
]
=
0
;
/* make sure it ends properly */
ins_node
->
log_pos_
=
log_file_pos
;
ins_node
->
log_pos_
=
log_file_pos
;
if
(
!
trx_front_
)
if
(
!
trx_front_
)
...
@@ -1009,13 +1010,15 @@ int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name,
...
@@ -1009,13 +1010,15 @@ int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name,
if
(
cmp
>
0
)
if
(
cmp
>
0
)
{
{
/* This is a larger position, let's update the maximum info. */
/* This is a larger position, let's update the maximum info. */
strcpy
(
commit_file_name_
,
log_file_name
);
strncpy
(
commit_file_name_
,
log_file_name
,
FN_REFLEN
-
1
);
commit_file_name_
[
FN_REFLEN
-
1
]
=
0
;
/* make sure it ends properly */
commit_file_pos_
=
log_file_pos
;
commit_file_pos_
=
log_file_pos
;
}
}
}
}
else
else
{
{
strcpy
(
commit_file_name_
,
log_file_name
);
strncpy
(
commit_file_name_
,
log_file_name
,
FN_REFLEN
-
1
);
commit_file_name_
[
FN_REFLEN
-
1
]
=
0
;
/* make sure it ends properly */
commit_file_pos_
=
log_file_pos
;
commit_file_pos_
=
log_file_pos
;
commit_file_name_inited_
=
true
;
commit_file_name_inited_
=
true
;
}
}
...
@@ -1048,6 +1051,7 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
...
@@ -1048,6 +1051,7 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
const
unsigned
char
*
packet
;
const
unsigned
char
*
packet
;
char
log_file_name
[
FN_REFLEN
];
char
log_file_name
[
FN_REFLEN
];
my_off_t
log_file_pos
;
my_off_t
log_file_pos
;
ulong
log_file_len
=
0
;
ulong
packet_len
;
ulong
packet_len
;
int
result
=
-
1
;
int
result
=
-
1
;
...
@@ -1123,7 +1127,13 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
...
@@ -1123,7 +1127,13 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id,
}
}
log_file_pos
=
uint8korr
(
packet
+
REPLY_BINLOG_POS_OFFSET
);
log_file_pos
=
uint8korr
(
packet
+
REPLY_BINLOG_POS_OFFSET
);
strcpy
(
log_file_name
,
(
const
char
*
)
packet
+
REPLY_BINLOG_NAME_OFFSET
);
log_file_len
=
packet_len
-
REPLY_BINLOG_NAME_OFFSET
;
if
(
log_file_len
>
FN_REFLEN
)
{
sql_print_error
(
"Read semi-sync reply binlog file length too large"
);
goto
l_end
;
}
strncpy
(
log_file_name
,
(
const
char
*
)
packet
+
REPLY_BINLOG_NAME_OFFSET
,
log_file_len
);
if
(
trc_level
&
kTraceDetail
)
if
(
trc_level
&
kTraceDetail
)
sql_print_information
(
"%s: Got reply (%s, %lu)"
,
sql_print_information
(
"%s: Got reply (%s, %lu)"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment