This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enventor.

View the commit online.

commit 98dc099263b290ed1237421b7f33c55ccf08dfd0
Author: Thanatermesis <[email protected]>
AuthorDate: Mon Feb 23 16:03:53 2026 -0500

    fix: Fix memory leaks and improve string handling in edc_parser
    
    I have identified several issues in src/lib/edc_parser.c, including potential memory leaks, buffer overflows, and logic errors.
    
    1. Fix Memory Leak in cur_context_thread_blocking
    
    The function calloc a buffer value_buf but only frees it inside the if (value_buf) block. However, if the loop finishes without finding a digit, the pointer remains NULL, which
    is fine, but the logic inside the loop for allocation is safer using value_len + 1 to ensure null-termination for atof.
---
 src/lib/edc_parser.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/lib/edc_parser.c b/src/lib/edc_parser.c
index c03d9ad..ff156e9 100644
--- a/src/lib/edc_parser.c
+++ b/src/lib/edc_parser.c
@@ -318,8 +318,8 @@ cur_context_thread_blocking(void *data, Ecore_Thread *thread)
                        if (isdigit(*value) || *value == '.')
                          {
                             value_len = value_end - value;
-                            value_buf = (char *)calloc(1, value_len);
-                            memcpy(value_buf, value, value_len);
+                            value_buf = (char *)calloc(1, value_len + 1);
+                            if (value_buf) memcpy(value_buf, value, value_len);
                             break;
                          }
                        value++;
@@ -1927,6 +1927,13 @@ parser_term(parser_data *pd)
                     eina_stringshare_del(eina_array_pop(attr->value.strs));
                   eina_array_free(attr->value.strs);
                }
+             if (attr->value.use_append_str_array && attr->value.append_str_array)
+               {
+                  while (eina_array_count(attr->value.append_str_array))
+                    eina_stringshare_del(eina_array_pop(attr->value.append_str_array));
+                  eina_array_free(attr->value.append_str_array);
+               }
+             if (attr->context) eina_stringshare_del(attr->context);
           }
         eina_inarray_free(pd->attrs);
      }
@@ -2000,14 +2007,19 @@ parser_is_image_name(const Evas_Object *entry, const char *str)
    if (end_pos < 0) return EINA_FALSE;
 
    char *candidate_str = alloca(end_pos - start_pos + 1);
-   const char *src_str = elm_entry_markup_to_utf8(str);
-   strncpy(candidate_str, utf8 + start_pos, end_pos - start_pos);
-   candidate_str[end_pos - start_pos] = '\0';
+   char *src_str = elm_entry_markup_to_utf8(str);
+   Eina_Bool found = EINA_FALSE;
 
-   if (strstr(candidate_str, src_str))
-     return EINA_TRUE;
-   else
-     return EINA_FALSE;
+   if (src_str)
+     {
+        strncpy(candidate_str, utf8 + start_pos, end_pos - start_pos);
+        candidate_str[end_pos - start_pos] = '\0';
+        if (strstr(candidate_str, src_str)) found = EINA_TRUE;
+        free(src_str);
+     }
+
+   free(utf8);
+   return found;
 }
 
 void
@@ -2151,7 +2163,8 @@ parser_group_list_get(parser_data *pd EINA_UNUSED, Evas_Object *entry)
             if (group_name)
               group_list = eina_list_append(group_list, group_name);
          }
-       p++;
+       if (p < (utf8 + utf8_len)) p++;
+       else break;
      }
 
 end:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to