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

git pushed a commit to branch fix/escape-null-handling
in repository terminology.

View the commit online.

commit 2132126462e846f134903e94f019b590918e27f7
Author: Cedric BAIL <[email protected]>
AuthorDate: Thu Apr 30 13:24:07 2026 -0600

    termio: skip ecore_exe_run when escape returns NULL
    
    When ecore_file_escape_name(...) returns NULL (allocation failure
    or invalid input), _activate_link previously fell through to
    ecore_exe_run(buf, NULL) with buf uninitialized, passing garbage
    stack data as a command line.
    
    Add early-return on NULL escape so we skip the exec entirely.
    
    Affects all 3 _activate_link branches: email, local file, remote URL.
---
 src/bin/termio.c | 168 +++++++++++++++++++++++++++++--------------------------
 1 file changed, 89 insertions(+), 79 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index baad9d0d..39961a29 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -794,11 +794,13 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
           p += sizeof("mailto:") - 1;
 
         escaped = ecore_file_escape_name(p);
-        if (escaped)
+        if (!escaped)
           {
-             snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
-             free(escaped);
+             free(s);
+             goto end;
           }
+        snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
+        free(escaped);
      }
    else if (path)
      {
@@ -810,51 +812,55 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
 #endif
 
         escaped = ecore_file_escape_name(path);
-        if (escaped)
+        if (!escaped)
           {
-             size_t len = strlen(path);
-             Media_Type type = media_src_type_get(path, len);
-             if (may_inline && _should_inline(obj))
-               {
-                  if ((type == MEDIA_TYPE_IMG) ||
-                      (type == MEDIA_TYPE_SCALE) ||
-                      (type == MEDIA_TYPE_EDJE))
-                    {
-                       evas_object_smart_callback_call(obj, "popup", NULL);
-                       handled = EINA_TRUE;
-                    }
-                  else if (type == MEDIA_TYPE_MOV)
-                    {
-                       evas_object_smart_callback_call(obj, "popup", NULL);
-                       handled = EINA_TRUE;
-                    }
-               }
-             if (!handled)
-               {
-                  if ((type == MEDIA_TYPE_IMG) ||
-                      (type == MEDIA_TYPE_SCALE) ||
-                      (type == MEDIA_TYPE_EDJE))
-                    {
-                       if ((config->helper.local.image) &&
-                           (config->helper.local.image[0]))
-                         cmd = config->helper.local.image;
-                    }
-                  else if (type == MEDIA_TYPE_MOV)
-                    {
-                       if ((config->helper.local.video) &&
-                           (config->helper.local.video[0]))
-                         cmd = config->helper.local.video;
-                    }
-                  else
-                    {
-                       if ((config->helper.local.general) &&
-                           (config->helper.local.general[0]))
-                         cmd = config->helper.local.general;
-                    }
-                  snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
-                  free(escaped);
-               }
+             free(s);
+             goto end;
           }
+        {
+           size_t len = strlen(path);
+           Media_Type type = media_src_type_get(path, len);
+           if (may_inline && _should_inline(obj))
+             {
+                if ((type == MEDIA_TYPE_IMG) ||
+                    (type == MEDIA_TYPE_SCALE) ||
+                    (type == MEDIA_TYPE_EDJE))
+                  {
+                     evas_object_smart_callback_call(obj, "popup", NULL);
+                     handled = EINA_TRUE;
+                  }
+                else if (type == MEDIA_TYPE_MOV)
+                  {
+                     evas_object_smart_callback_call(obj, "popup", NULL);
+                     handled = EINA_TRUE;
+                  }
+             }
+           if (!handled)
+             {
+                if ((type == MEDIA_TYPE_IMG) ||
+                    (type == MEDIA_TYPE_SCALE) ||
+                    (type == MEDIA_TYPE_EDJE))
+                  {
+                     if ((config->helper.local.image) &&
+                         (config->helper.local.image[0]))
+                       cmd = config->helper.local.image;
+                  }
+                else if (type == MEDIA_TYPE_MOV)
+                  {
+                     if ((config->helper.local.video) &&
+                         (config->helper.local.video[0]))
+                       cmd = config->helper.local.video;
+                  }
+                else
+                  {
+                     if ((config->helper.local.general) &&
+                         (config->helper.local.general[0]))
+                       cmd = config->helper.local.general;
+                  }
+                snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
+                free(escaped);
+             }
+        }
      }
    else if (url)
      {
@@ -866,41 +872,45 @@ _activate_link(Evas_Object *obj, Eina_Bool may_inline)
 #endif
 
         escaped = ecore_file_escape_name(s);
-        if (escaped)
+        if (!escaped)
           {
-             size_t len = strlen(link);
-             Media_Type type = media_src_type_get(link, len);
-             if (may_inline && _should_inline(obj))
-               {
-                  evas_object_smart_callback_call(obj, "popup", NULL);
-                  handled = EINA_TRUE;
-               }
-             if (!handled)
-               {
-                  if ((type == MEDIA_TYPE_IMG) ||
-                      (type == MEDIA_TYPE_SCALE) ||
-                      (type == MEDIA_TYPE_EDJE))
-                    {
-                       if ((config->helper.url.image) &&
-                           (config->helper.url.image[0]))
-                         cmd = config->helper.url.image;
-                    }
-                  else if (type == MEDIA_TYPE_MOV)
-                    {
-                       if ((config->helper.url.video) &&
-                           (config->helper.url.video[0]))
-                         cmd = config->helper.url.video;
-                    }
-                  else
-                    {
-                       if ((config->helper.url.general) &&
-                           (config->helper.url.general[0]))
-                         cmd = config->helper.url.general;
-                    }
-                  snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
-                  free(escaped);
-               }
+             free(s);
+             goto end;
           }
+        {
+           size_t len = strlen(link);
+           Media_Type type = media_src_type_get(link, len);
+           if (may_inline && _should_inline(obj))
+             {
+                evas_object_smart_callback_call(obj, "popup", NULL);
+                handled = EINA_TRUE;
+             }
+           if (!handled)
+             {
+                if ((type == MEDIA_TYPE_IMG) ||
+                    (type == MEDIA_TYPE_SCALE) ||
+                    (type == MEDIA_TYPE_EDJE))
+                  {
+                     if ((config->helper.url.image) &&
+                         (config->helper.url.image[0]))
+                       cmd = config->helper.url.image;
+                  }
+                else if (type == MEDIA_TYPE_MOV)
+                  {
+                     if ((config->helper.url.video) &&
+                         (config->helper.url.video[0]))
+                       cmd = config->helper.url.video;
+                  }
+                else
+                  {
+                     if ((config->helper.url.general) &&
+                         (config->helper.url.general[0]))
+                       cmd = config->helper.url.general;
+                  }
+                snprintf(buf, sizeof(buf), "%s %s", cmd, escaped);
+                free(escaped);
+             }
+        }
      }
    else
      {

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

Reply via email to