Compare commits

...

3 Commits

Author SHA1 Message Date
YuQing f15fc50e3b check returned length of snprintf to avoid overflow 2026-09-04 15:20:56 +08:00
YuQing ed4575f62a upgrade version to 1.2.15 2026-09-04 11:16:48 +08:00
YuQing 7237e50f6d sync_log_buff_interval support time unit as 5m for 5 minutes 2026-09-04 11:15:01 +08:00
4 changed files with 22 additions and 7 deletions

View File

@ -2,7 +2,7 @@
%define CommitVersion %(echo $COMMIT_VERSION) %define CommitVersion %(echo $COMMIT_VERSION)
Name: libserverframe Name: libserverframe
Version: 1.2.14 Version: 1.2.15
Release: 1%{?dist} Release: 1%{?dist}
Summary: network framework library Summary: network framework library
License: AGPL v3.0 License: AGPL v3.0
@ -12,9 +12,9 @@ Source: http://github.com/happyfish100/libserverframe/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: libfastcommon-devel >= 1.0.86 BuildRequires: libfastcommon-devel >= 1.0.88
Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id Requires: %__cp %__mv %__chmod %__grep %__mkdir %__install %__id
Requires: libfastcommon >= 1.0.86 Requires: libfastcommon >= 1.0.88
%description %description
common framework library common framework library

View File

@ -161,9 +161,9 @@ int sf_load_log_config(IniFullContext *ini_ctx, LogContext *log_ctx,
{ {
int result; int result;
log_cfg->sync_log_buff_interval = iniGetIntValueEx( log_cfg->sync_log_buff_interval = iniGetTimestampValueEx(
ini_ctx->section_name, "sync_log_buff_interval", ini_ctx->section_name, "sync_log_buff_interval",
ini_ctx->context, SF_DEF_SYNC_LOG_BUFF_INTERVAL, true); ini_ctx->context, SF_DEF_SYNC_LOG_BUFF_INTERVAL, 1, true);
if (log_cfg->sync_log_buff_interval <= 0) { if (log_cfg->sync_log_buff_interval <= 0) {
log_cfg->sync_log_buff_interval = SF_DEF_SYNC_LOG_BUFF_INTERVAL; log_cfg->sync_log_buff_interval = SF_DEF_SYNC_LOG_BUFF_INTERVAL;
} }
@ -968,6 +968,9 @@ void sf_context_config_to_string(const SFContext *sf_context,
sock_handler->inner.port, inner_bind_addr, sock_handler->inner.port, inner_bind_addr,
sock_handler->outer.port, outer_bind_addr); sock_handler->outer.port, outer_bind_addr);
} }
if (len >= size) {
return;
}
len += snprintf(output + len, size - len, len += snprintf(output + len, size - len,
", address_family=%s, accept_threads=%d, work_threads=%d", ", address_family=%s, accept_threads=%d, work_threads=%d",
@ -975,6 +978,9 @@ void sf_context_config_to_string(const SFContext *sf_context,
sf_context->accept_threads, sf_context->work_threads); sf_context->accept_threads, sf_context->work_threads);
#if IOEVENT_USE_URING #if IOEVENT_USE_URING
if (len >= size) {
return;
}
len += snprintf(output + len, size - len, ", use_io_uring=%d, " len += snprintf(output + len, size - len, ", use_io_uring=%d, "
"use_send_zc=%d", sf_context->use_io_uring, "use_send_zc=%d", sf_context->use_io_uring,
sf_context->use_send_zc); sf_context->use_send_zc);
@ -1072,11 +1078,17 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
g_sf_global_vars.thread_stack_size / 1024, pkg_buff); g_sf_global_vars.thread_stack_size / 1024, pkg_buff);
#if IOEVENT_USE_URING #if IOEVENT_USE_URING
if (len >= size) {
return;
}
len += snprintf(output + len, size - len, "use_io_uring=%d, " len += snprintf(output + len, size - len, "use_io_uring=%d, "
"use_send_zc=%d, ", g_sf_context.use_io_uring, "use_send_zc=%d, ", g_sf_context.use_io_uring,
g_sf_context.use_send_zc); g_sf_context.use_send_zc);
#endif #endif
if (len >= size) {
return;
}
len += snprintf(output + len, size - len, len += snprintf(output + len, size - len,
"tcp_quick_ack=%d, " "tcp_quick_ack=%d, "
"log_level=%s, " "log_level=%s, "
@ -1085,6 +1097,9 @@ void sf_global_config_to_string_ex(const char *max_pkg_size_item_nm,
log_get_level_caption(), log_get_level_caption(),
g_sf_global_vars.run_by.group, g_sf_global_vars.run_by.group,
g_sf_global_vars.run_by.user); g_sf_global_vars.run_by.user);
if (len >= size) {
return;
}
sf_log_config_to_string(&g_sf_global_vars.error_log, sf_log_config_to_string(&g_sf_global_vars.error_log,
"error-log", output + len, size - len); "error-log", output + len, size - len);

View File

@ -95,7 +95,7 @@ int sf_printbuffer(char* buffer,int32_t len)
void sf_usage_ex(const char *program, const SFCMDOption *other_options) void sf_usage_ex(const char *program, const SFCMDOption *other_options)
{ {
fprintf(stderr, "\nUsage: %s [options] <config_file> " fprintf(stderr, "\nUsage: %s [options] <config_file> "
"[start | stop | restart | status]\n\noptions:\n", program); "[start | stop | restart | status]\n\nOptions:\n", program);
if (other_options != NULL) { if (other_options != NULL) {
const SFCMDOption *option; const SFCMDOption *option;

View File

@ -22,7 +22,7 @@
#define SF_MAJOR_VERSION 1 #define SF_MAJOR_VERSION 1
#define SF_MINOR_VERSION 2 #define SF_MINOR_VERSION 2
#define SF_PATCH_VERSION 14 #define SF_PATCH_VERSION 15
#define SF_VERSION_INT FC_VERSION_TO_INT(SF_MAJOR_VERSION, \ #define SF_VERSION_INT FC_VERSION_TO_INT(SF_MAJOR_VERSION, \
SF_MINOR_VERSION, SF_PATCH_VERSION) SF_MINOR_VERSION, SF_PATCH_VERSION)