summaryrefslogtreecommitdiff
path: root/sql/signal_handler.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-05-15 16:15:49 +0300
committerMonty <monty@mariadb.org>2020-05-23 12:29:10 +0300
commitc4bf4b7aefcd95b898ea9c8714d09fc1045f304c (patch)
treef45c4aefb9e22ecadf8e2e8ac19d0673c88a8e69 /sql/signal_handler.cc
parentdcc0baf5405b220384b9e1e07d8b9e3ff97b60f4 (diff)
downloadmariadb-git-c4bf4b7aefcd95b898ea9c8714d09fc1045f304c.tar.gz
Fixed access to undefined memory found by valgrind and MSAN
When my_vsnprintf() is patched, the code protected disabled with 'WAITING_FOR_BUGFIX_TO_VSPRINTF' should be enabled again. Also all %b formats in this patch should be revert to %s again
Diffstat (limited to 'sql/signal_handler.cc')
-rw-r--r--sql/signal_handler.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc
index 467985c1270..147b2568981 100644
--- a/sql/signal_handler.cc
+++ b/sql/signal_handler.cc
@@ -52,8 +52,9 @@ static inline void output_core_info()
char buff[PATH_MAX];
ssize_t len;
int fd;
- if ((len= readlink("/proc/self/cwd", buff, sizeof(buff))) >= 0)
+ if ((len= readlink("/proc/self/cwd", buff, sizeof(buff)-1)) >= 0)
{
+ buff[len]= 0;
my_safe_printf_stderr("Writing a core file...\nWorking directory at %.*s\n",
(int) len, buff);
}