gazelle/0095-fix-func-separate_str_to_array-overflow-problem.patch

27 lines
823 B
Diff
Raw Normal View History

From f6a7a9585bfb82680519034869b4141c514d9214 Mon Sep 17 00:00:00 2001
From: yinbin <yinbin8@huawei.com>
Date: Mon, 25 Dec 2023 00:34:55 +0800
Subject: [PATCH] fix func separate_str_to_array overflow problem
---
src/common/gazelle_parse_config.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/common/gazelle_parse_config.c b/src/common/gazelle_parse_config.c
index 42e12b5..77d0b82 100644
--- a/src/common/gazelle_parse_config.c
+++ b/src/common/gazelle_parse_config.c
@@ -80,6 +80,9 @@ int32_t separate_str_to_array(char *args, uint32_t *array, int32_t array_size, i
for (idx = min; idx <= max; idx++) {
array[count] = idx;
count++;
+ if (count > array_size) {
+ return -1;
+ }
}
min = array_size;
} else {
--
2.27.0