- fix the pointer position update error after enviroment variable is replaced. - ignore the rule when the environment in %E(env) isn't found. Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
From 40ea87cd0b2073a622b3186900faaace7e6ca57b Mon Sep 17 00:00:00 2001
|
|
From: tangjie02 <tangjie02@kylinos.com.cn>
|
|
Date: Fri, 9 Jul 2021 10:25:48 +0800
|
|
Subject: [PATCH 1012/1013] feature(environment): Ignore the rule when the
|
|
environment in %E(env) isn't found.
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 当通过%E(env)语法表示的环境变量未找到时忽略该条规则
|
|
|
|
Signed-off-by: tangjie02 <tangjie02@kylinos.com.cn>
|
|
---
|
|
src/zc_util.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/zc_util.c b/src/zc_util.c
|
|
index b5ee1c2..a77c763 100644
|
|
--- a/src/zc_util.c
|
|
+++ b/src/zc_util.c
|
|
@@ -130,7 +130,7 @@ int zc_str_replace_env(char *str, size_t str_size)
|
|
}
|
|
|
|
env_value_len = snprintf(env_value, sizeof(env_value), fmt, getenv(env_key));
|
|
- if (env_value_len < 0 || env_value_len >= sizeof(env_value)) {
|
|
+ if (getenv(env_key) == NULL || env_value_len < 0 || env_value_len >= sizeof(env_value)) {
|
|
zc_error("snprintf fail, errno[%d], evn_value_len[%d]",
|
|
errno, env_value_len);
|
|
return -1;
|
|
--
|
|
2.27.0
|
|
|