diff --git a/query_classifier/qc_sqlite/CMakeLists.txt b/query_classifier/qc_sqlite/CMakeLists.txt index 59c82a1ac..345e48610 100644 --- a/query_classifier/qc_sqlite/CMakeLists.txt +++ b/query_classifier/qc_sqlite/CMakeLists.txt @@ -1,7 +1,3 @@ -if(NOT ${CMAKE_VERSION} VERSION_LESS 3.0.0) - cmake_policy(SET CMP0046 OLD) -endif() - include(ExternalProject) ExternalProject_Add(maxscale_sqlite @@ -10,7 +6,6 @@ ExternalProject_Add(maxscale_sqlite CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100/configure --with-pic --enable-maxscale BUILD_COMMAND make sqlite3.c INSTALL_COMMAND "") -add_dependencies(maxscale_sqlite ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100/src/parse.y) include_directories(${CMAKE_BINARY_DIR}/sqlite-bld-3110100/tsrc) include_directories(${CMAKE_BINARY_DIR}/sqlite-bld-3110100) diff --git a/server/core/config.cc b/server/core/config.cc index ff41c2875..469d65482 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -2537,7 +2537,8 @@ config_get_release_string(char* release) } have_distribution = true; - strncpy(release, new_to, RELEASE_STR_LENGTH); + strncpy(release, new_to, RELEASE_STR_LENGTH - 1); + release[RELEASE_STR_LENGTH - 1] = '\0'; } } } diff --git a/server/core/internal/skygw_utils.h b/server/core/internal/skygw_utils.h index 1c4b6e85c..6fca7cc1c 100644 --- a/server/core/internal/skygw_utils.h +++ b/server/core/internal/skygw_utils.h @@ -46,12 +46,12 @@ typedef enum { MES_RC_FAIL, MES_RC_SUCCESS, MES_RC_TIMEOUT } skygw_mes_rc_t; static const char* timestamp_formatstr = "%04d-%02d-%02d %02d:%02d:%02d "; /** One for terminating '\0' */ -static const size_t timestamp_len = (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 3 + 1) * sizeof(char); +static const size_t timestamp_len = (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 3 + 1 + 16) * sizeof(char); static const char* timestamp_formatstr_hp = "%04d-%02d-%02d %02d:%02d:%02d.%03d "; /** One for terminating '\0' */ -static const size_t timestamp_len_hp = (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 3 + 1) * sizeof( - char); +static const size_t timestamp_len_hp = (4 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 + 3 + 3 + 1 + 16) * + sizeof(char); struct skygw_thread_st { diff --git a/server/inih/ini.c b/server/inih/ini.c index 9f9110eaf..ac185fb55 100644 --- a/server/inih/ini.c +++ b/server/inih/ini.c @@ -117,7 +117,7 @@ int ini_parse_file(FILE* file, end = find_char_or_comment(start + 1, ']'); if (*end == ']') { *end = '\0'; - strncpy0(section, start + 1, sizeof(section)); + strncpy0(section, start + 1, sizeof(section) - 1); *prev_name = '\0'; } else if (!error) { @@ -141,7 +141,7 @@ int ini_parse_file(FILE* file, rstrip(value); /* Valid name[=:]value pair found, call handler */ - strncpy0(prev_name, name, sizeof(prev_name)); + strncpy0(prev_name, name, sizeof(prev_name) - 1); if (!handler(user, section, name, value) && !error) error = lineno; } diff --git a/server/modules/routing/binlogrouter/blr_file.c b/server/modules/routing/binlogrouter/blr_file.c index 8561621d4..81cc564c2 100644 --- a/server/modules/routing/binlogrouter/blr_file.c +++ b/server/modules/routing/binlogrouter/blr_file.c @@ -1669,7 +1669,7 @@ blr_file_next_exists(ROUTER_INSTANCE *router, sprintf(buf, BINLOG_NAMEFMT, router->fileroot, filenum + 1); sprintf(bigbuf, "%s/%s", router->binlogdir, buf); // Set the new file name in the output - strncpy(next_file, buf, BINLOG_FNAMELEN); + memcpy(next_file, buf, BINLOG_FNAMELEN); next_file[BINLOG_FNAMELEN] = '\0'; } else @@ -1712,7 +1712,7 @@ blr_file_next_exists(ROUTER_INSTANCE *router, result.gtid_elms.server_id, result.file); // Set the new file name in the output - strncpy(next_file, result.file, BINLOG_FNAMELEN); + memcpy(next_file, result.file, BINLOG_FNAMELEN); next_file[BINLOG_FNAMELEN] = '\0'; MXS_DEBUG("The next Binlog file from GTID maps repo is [%s]",