diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-22 11:15:21 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-03-22 11:15:21 +0200 |
commit | 031fa8f1d260cd9fae67a307d901bd4432bdf1cb (patch) | |
tree | 36c96ba92e2f345dd26cc8ebe521dde1906ad384 /plugin/server_audit | |
parent | 1caec9c8982a73f3db78fabc570934b837658109 (diff) | |
parent | 8be02be08bf6a7227e2ab6a5443b63f3a155e2a9 (diff) | |
download | mariadb-git-031fa8f1d260cd9fae67a307d901bd4432bdf1cb.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'plugin/server_audit')
-rw-r--r-- | plugin/server_audit/server_audit.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 612e9e91515..0995327a86d 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -1053,7 +1053,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)); + strncpy(current_log_buf, alt_fname, sizeof(current_log_buf)-1); current_log_buf[sizeof(current_log_buf)-1]= 0; } else if (output_type == OUTPUT_SYSLOG) @@ -1061,7 +1061,8 @@ static int start_logging() openlog(syslog_ident, LOG_NOWAIT, syslog_facility_codes[syslog_facility]); error_header(); fprintf(stderr, "logging started to the syslog.\n"); - strncpy(current_log_buf, "[SYSLOG]", sizeof(current_log_buf)); + strncpy(current_log_buf, "[SYSLOG]", sizeof(current_log_buf)-1); + compile_time_assert(sizeof current_log_buf > sizeof "[SYSLOG]"); } is_active= 1; return 0; @@ -2597,7 +2598,7 @@ static void update_file_path(MYSQL_THD thd, internal_stop_logging= 0; } - strncpy(path_buffer, new_name, sizeof(path_buffer)); + strncpy(path_buffer, new_name, sizeof(path_buffer)-1); path_buffer[sizeof(path_buffer)-1]= 0; file_path= path_buffer; exit_func: @@ -2650,7 +2651,7 @@ static void update_incl_users(MYSQL_THD thd, if (!maria_55_started || !debug_server_started) flogger_mutex_lock(&lock_operations); mark_always_logged(thd); - strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer)); + strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer)-1); 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); @@ -2669,7 +2670,7 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)), if (!maria_55_started || !debug_server_started) flogger_mutex_lock(&lock_operations); mark_always_logged(thd); - strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer)); + strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer)-1); 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); @@ -2801,7 +2802,7 @@ static void update_syslog_ident(MYSQL_THD thd __attribute__((unused)), void *var_ptr __attribute__((unused)), const void *save) { char *new_ident= (*(char **) save) ? *(char **) save : empty_str; - strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer)); + strncpy(syslog_ident_buffer, new_ident, sizeof(syslog_ident_buffer)-1); syslog_ident_buffer[sizeof(syslog_ident_buffer)-1]= 0; syslog_ident= syslog_ident_buffer; error_header(); |