From e4eeed95dcbb47b3413e51df6c82e85a735aa31c Mon Sep 17 00:00:00 2001
From: yinbin6 <yinbin8@huawei.com>
Date: Mon, 25 Dec 2023 09:31:44 +0000
Subject: [PATCH] fix func separate_str_to_array overflow problem

Signed-off-by: yinbin6 <yinbin8@huawei.com>
---
 src/common/gazelle_parse_config.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common/gazelle_parse_config.c b/src/common/gazelle_parse_config.c
index 77d0b82..82be52c 100644
--- a/src/common/gazelle_parse_config.c
+++ b/src/common/gazelle_parse_config.c
@@ -78,11 +78,11 @@ int32_t separate_str_to_array(char *args, uint32_t *array, int32_t array_size, i
                 min = idx;
             }
             for (idx = min; idx <= max; idx++) {
+                if (count > array_size) {
+		            return -1;
+		        }
                 array[count] = idx;
                 count++;
-		if (count > array_size) {
-		    return -1;
-		}
             }
             min = array_size;
         } else {
-- 
2.27.0

