summaryrefslogtreecommitdiff
path: root/plugin/server_audit
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-05-17 15:16:24 +0200
committerSergei Golubchik <serg@mariadb.org>2017-05-19 20:26:56 +0200
commit7c03edf2fe66855a8ce8f2575c3aaf66af975377 (patch)
tree7e793f937b759c8808668c8924b71a962f9b21f8 /plugin/server_audit
parent335c4ab790254462753ba4ed8b074c5847b2708f (diff)
downloadmariadb-git-7c03edf2fe66855a8ce8f2575c3aaf66af975377.tar.gz
MDEV-6262 analyze the coverity report on mariadb
uploaded 10.0, analyzed everything with the Impact=High (and a couple of Medium)
Diffstat (limited to 'plugin/server_audit')
-rw-r--r--plugin/server_audit/server_audit.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c
index de0b7bfae8e..c4b6fa361a3 100644
--- a/plugin/server_audit/server_audit.c
+++ b/plugin/server_audit/server_audit.c
@@ -1041,6 +1041,7 @@ static int start_logging()
error_header();
fprintf(stderr, "logging started to the file %s.\n", alt_fname);
strncpy(current_log_buf, alt_fname, sizeof(current_log_buf));
+ current_log_buf[sizeof(current_log_buf)-1]= 0;
}
else if (output_type == OUTPUT_SYSLOG)
{
@@ -2570,6 +2571,7 @@ static void update_file_path(MYSQL_THD thd,
}
strncpy(path_buffer, new_name, sizeof(path_buffer));
+ path_buffer[sizeof(path_buffer)-1]= 0;
file_path= path_buffer;
exit_func:
internal_stop_logging= 0;
@@ -2622,6 +2624,7 @@ static void update_incl_users(MYSQL_THD thd,
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer));
+ incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
incl_users= incl_user_buffer;
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
error_header();
@@ -2640,6 +2643,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
flogger_mutex_lock(&lock_operations);
mark_always_logged(thd);
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer));
+ excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
excl_users= excl_user_buffer;
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
error_header();
@@ -2771,6 +2775,7 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)),
{
char *new_ident= (*(char **) save) ? *(char **) save : empty_str;
strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer));
+ syslog_ident_buffer[sizeof(syslog_ident_buffer)-1]= 0;
syslog_ident= syslog_ident_buffer;
error_header();
fprintf(stderr, "SYSYLOG ident was changed to '%s'\n", syslog_ident);