代码拉取完成,页面将自动刷新
From 6c0823454ef075fedacf0b155e088ffc447985d6 Mon Sep 17 00:00:00 2001
From: yefeng <yefeng@kylinos.com.cn>
Date: Wed, 20 Apr 2022 13:43:22 +0800
Subject: [PATCH] Fix stack-buffer-overflow at zlog_conf_build_with_file
-#53811
---
src/conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf.c b/src/conf.c
index a947178..258a59a 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -375,6 +375,7 @@
*/
pline = line;
memset(&line, 0x00, sizeof(line));
+ //循环读取配置文件的一行
while (sgets(pline, MAXLEN_CFG_LINE, &conf_string_l) != NULL) {
++line_no;
line_len = strlen(pline);
@@ -399,12 +400,13 @@
for (p = pline + strlen(pline) - 1; isspace((int)*p); --p)
/*EMPTY*/;
+ //处理结束符为 '\\' 的特殊情况, 在这种情况下,当前行与下面一行并做一行处理
if (*p == '\\') {
if ((p - line) > MAXLEN_CFG_LINE - 30) {
/* Oops the buffer is full - what now? */
pline = line;
} else {
- for (p--; isspace((int)*p); --p)
+ for (p--; p >= line && isspace((int)*p); --p)
/*EMPTY*/;
p++;
*p = 0;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。