summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysys/mf_pack.c4
-rw-r--r--sql/log.cc2
-rw-r--r--sql/unireg.cc5
3 files changed, 8 insertions, 3 deletions
diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c
index a31b9595c85..63525e4d927 100644
--- a/mysys/mf_pack.c
+++ b/mysys/mf_pack.c
@@ -282,7 +282,7 @@ void symdirget(char *dir)
SYNOPSIS
unpack_dirname()
- to Store result here. May be = from
+ to result-buffer, FN_REFLEN characters. may be == from
from 'Packed' directory name (may contain ~)
IMPLEMENTATION
@@ -408,7 +408,7 @@ size_t unpack_filename(char * to, const char *from)
/* Convert filename (unix standard) to system standard */
/* Used before system command's like open(), create() .. */
- /* Returns length of to */
+ /* Returns used length of to; total length should be FN_REFLEN */
size_t system_filename(char * to, const char *from)
{
diff --git a/sql/log.cc b/sql/log.cc
index 500c66bd892..1789b56014c 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2998,7 +2998,7 @@ err:
void MYSQL_BIN_LOG::make_log_name(char* buf, const char* log_ident)
{
uint dir_len = dirname_length(log_file_name);
- if (dir_len > FN_REFLEN)
+ if (dir_len >= FN_REFLEN)
dir_len=FN_REFLEN-1;
strnmov(buf, log_file_name, dir_len);
strmake(buf+dir_len, log_ident, FN_REFLEN - dir_len -1);
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 8f2d10d4e2a..3ef1e4576e1 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -228,6 +228,11 @@ bool mysql_create_frm(THD *thd, const char *file_name,
create_info->comment.str : "", create_info->comment.length);
forminfo[46]=(uchar) create_info->comment.length;
#ifdef EXTRA_DEBUG
+ /*
+ EXTRA_DEBUG causes strmake() to initialize its buffer behind the
+ payload with a magic value to detect wrong buffer-sizes. We
+ explicitly zero that segment again.
+ */
memset((char*) forminfo+47 + forminfo[46], 0, 61 - forminfo[46]);
#endif
#ifdef WITH_PARTITION_STORAGE_ENGINE