From d4b763c6359d67e1efe9b5e1fde41c0b82eb3d58 Mon Sep 17 00:00:00 2001
From: xuxuepeng <xuxuepeng1@huawei.com>
Date: Wed, 23 Aug 2023 01:51:35 +0000
Subject: [PATCH 03/10] !2118 Fix exec buffer overflow * Fix buffer overflow
 for exec

---
 src/daemon/modules/service/service_container.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c
index 9960ace1..0f4a1ed6 100644
--- a/src/daemon/modules/service/service_container.c
+++ b/src/daemon/modules/service/service_container.c
@@ -2016,7 +2016,7 @@ static void get_exec_command(const container_exec_request *request, char *exec_c
     for (i = 0; i < request->argv_len; i++) {
         if (strlen(request->argv[i]) < len - strlen(exec_command)) {
             (void)strcat(exec_command, request->argv[i]);
-            if (i != (request->argv_len - 1)) {
+            if (i != (request->argv_len - 1) && len - strlen(exec_command) > 1) {
                 (void)strcat(exec_command, " ");
             }
         } else {
-- 
2.25.1

