From de9ed770a254c8f67ac228f56fe461e1c834609c Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Sat, 11 May 2024 07:51:35 +0000
Subject: [PATCH 84/85] trim key/value for env

Signed-off-by: jikai <jikai11@huawei.com>
---
 src/daemon/modules/spec/specs_extend.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/daemon/modules/spec/specs_extend.c b/src/daemon/modules/spec/specs_extend.c
index f4208405..926aaf3c 100644
--- a/src/daemon/modules/spec/specs_extend.c
+++ b/src/daemon/modules/spec/specs_extend.c
@@ -205,6 +205,8 @@ static int generate_env_map_from_file(FILE *fp, json_map_string_string *env_map)
             // ignore invalid env
             continue;
         }
+        key = util_trim_space(key);
+        value = util_trim_space(value);
         if ((size_t)(MAX_BUFFER_SIZE - 1) - strlen(key) < strlen(value)) {
             ERROR("env length exceed %d bytes", MAX_BUFFER_SIZE);
             return -1;
-- 
2.34.1

