#At file:///home/andrei/MySQL/BZR/mysql-5.1-telco-6.3/ based on revid:jonas@stripped
2791 Andrei Elkin 2008-12-12
Bug #39077 Command "change master" causes server crash (test "rpl_heartbeat")
The crash happened due to too small size of a char array that is used to print out
a warning on out-of-range for the heartbeat value.
Corrected with setting the size to a suffieciently large value.
modified:
sql/sql_yacc.yy
per-file messages:
sql/sql_yacc.yy
Correcting the size of char buf[] array to include the format string length.
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2008-12-10 15:35:47 +0000
+++ b/sql/sql_yacc.yy 2008-12-11 22:03:01 +0000
@@ -1639,8 +1639,9 @@ master_def:
if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD ||
Lex->mi.heartbeat_period < 0.0)
{
- char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4)];
- my_sprintf(buf, (buf, "%d seconds", SLAVE_MAX_HEARTBEAT_PERIOD));
+ const char format[]= "%d seconds";
+ char buf[sizeof(SLAVE_MAX_HEARTBEAT_PERIOD*4) + sizeof(format)];
+ my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD));
my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE,
MYF(0),
" is negative or exceeds the maximum ",