fix memory overflow

This commit is contained in:
fengzero
2026-07-01 06:59:53 +00:00
parent e236d829f5
commit d49b122ceb
4 changed files with 39 additions and 19 deletions
+3 -1
View File
@@ -872,7 +872,9 @@ void handle_get_server_security_policy_resp(
if (resp->policy_name != NULL && strlen(resp->policy_name) > 0) {
// Split policy names by comma
char *token = strtok(resp->policy_name, ",");
while (token != NULL) {
while (token != NULL &&
policy_count <
(int) (sizeof(policy_names) / sizeof(policy_names[0]))) {
policy_names[policy_count] = strdup(token);
policy_count++;
token = strtok(NULL, ",");