diff --git a/HISTORY b/HISTORY index 81a48a6..599f167 100644 --- a/HISTORY +++ b/HISTORY @@ -1,4 +1,7 @@ +Version 1.88 2026-09-03 + * local_host_ip_addrs_to_string: fix buffer overflow + Version 1.87 2026-07-10 * ini_file_readers can refer env variable such as %{env::FASTDFS_IPADDR} diff --git a/doc/ini_file_reader-Chinese.md b/doc/ini_file_reader-Chinese.md index c2951ed..229dd1d 100644 --- a/doc/ini_file_reader-Chinese.md +++ b/doc/ini_file_reader-Chinese.md @@ -10,7 +10,7 @@ libfastcommon是在github开源的⼀个C函数库。它提供了ini⽂件解析 ## ini_file_reader的主要特点: ### 1、⽀持section -例如: +例如: ``` [workers] threads = 4 diff --git a/src/local_ip_func.c b/src/local_ip_func.c index 7ab1290..b6c9237 100644 --- a/src/local_ip_func.c +++ b/src/local_ip_func.c @@ -70,12 +70,21 @@ const char *local_host_ip_addrs_to_string(char *buff, const int size) len = snprintf(buff, size, "local_host_ip_count: %d,", g_local_host_ip_count); + if (len >= size) + { + return buff; + } + pEnd = g_local_host_ip_addrs + IP_ADDRESS_SIZE * g_local_host_ip_count; for (p=g_local_host_ip_addrs; p= size) + { + break; + } + } return buff; }