diff options
author | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2007-11-26 08:20:40 +0100 |
---|---|---|
committer | unknown <tnurnberg@mysql.com/white.intern.koehntopp.de> | 2007-11-26 08:20:40 +0100 |
commit | a905ac34b59731bb69a036306297c50742753329 (patch) | |
tree | e6e0d5c6e9e90e5a7e95d8325c0eedbee083ff12 /sql/repl_failsafe.cc | |
parent | 77d786b5a0cd303d30b9a22a044b916078551e6c (diff) | |
download | mariadb-git-a905ac34b59731bb69a036306297c50742753329.tar.gz |
Bug#31752: check strmake() bounds
strmake() calls are easy to get wrong. Add checks in extra
debug mode to identify possible exploits.
Remove some dead code.
Remove some off-by-one errors identified with new checks.
sql/log.cc:
fix off-by-one buffer-length argument to prevent stack smashing
sql/repl_failsafe.cc:
fix off-by-one buffer-length argument to prevent stack smashing
sql/set_var.cc:
fix off-by-one buffer-length argument to prevent stack smashing
(already approved, backports #31588)
sql/sql_show.cc:
misdimensioned buffers: functions further down the callstack
expect bufsize of FN_REFLEN
sql/unireg.cc:
When EXTRA_DEBUG is enabled, strmake() will write funny patterns to
buffers it operates on to identify possibly overflows. This leads to
badness in mysql_create_frm(), so we explicitly put any unused bytes
(back) into a defined state. Not a bug-fix, but part of the strmake()
bug detector.
strings/strmake.c:
strmake() takes maximum string length rather than buffer-length
(string length + 1 to accomodate \0 terminator) as argument.
Since this is easy to get wrong, add extra debug code to identify
off-by-ones so we can prevent stack smashing.
Alternative "BAD_STRING_COMPILER" removed after checking
with Monty.
Diffstat (limited to 'sql/repl_failsafe.cc')
-rw-r--r-- | sql/repl_failsafe.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index 4c8703226a6..4ea90346638 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -926,7 +926,7 @@ int load_master_data(THD* thd) 0, (SLAVE_IO | SLAVE_SQL))) send_error(thd, ER_MASTER_INFO); strmake(active_mi->master_log_name, row[0], - sizeof(active_mi->master_log_name)); + sizeof(active_mi->master_log_name) -1); active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error); /* at least in recent versions, the condition below should be false */ if (active_mi->master_log_pos < BIN_LOG_HEADER_SIZE) |