From 05ce23e6320afe2bbf7b6cdf89dff3904dff7156 Mon Sep 17 00:00:00 2001 From: orbisai0security Date: Thu, 21 May 2026 07:06:09 +0000 Subject: [PATCH] fix: utils.custom.integer-overflow-malloc security vulnerability Automated security fix generated by OrbisAI Security --- st.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/st.c b/st.c index 0267285..e82bb58 100644 --- a/st.c +++ b/st.c @@ -621,8 +621,8 @@ st_init_table_with_size(const struct st_hash_type *type, st_index_t size) } #endif } - tab->entries = (st_table_entry *) malloc(get_allocated_entries(tab) - * sizeof(st_table_entry)); + tab->entries = (st_table_entry *) calloc(get_allocated_entries(tab), + sizeof(st_table_entry)); #ifndef RUBY if (tab->entries == NULL) { st_free_table(tab); @@ -1349,8 +1349,8 @@ st_copy(st_table *old_tab) } #endif } - new_tab->entries = (st_table_entry *) malloc(get_allocated_entries(old_tab) - * sizeof(st_table_entry)); + new_tab->entries = (st_table_entry *) calloc(get_allocated_entries(old_tab), + sizeof(st_table_entry)); #ifndef RUBY if (new_tab->entries == NULL) { st_free_table(new_tab);