raster pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=b389ed2b89d7b572f210c9c159519f4029452226

commit b389ed2b89d7b572f210c9c159519f4029452226
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Fri Nov 16 12:47:16 2018 +0000

    check if buffer size is too small strunc was truncated
---
 src/bin/termio.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index 6ae707e..6fbd33d 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -2077,17 +2077,28 @@ _block_edje_activate(Evas_Object *obj, Termblock *blk)
 
         if (homedir_get(home, sizeof(home)))
           {
-             snprintf(path, sizeof(path), "%s/.terminology/objlib/%s",
-                      home, blk->path);
+             if ((size_t)snprintf(path, sizeof(path),
+                                  "%s/.terminology/objlib/%s",
+                                  home, blk->path) >= sizeof(path))
+               {
+                  ERR("Not enough space in buffer for path to edje lib file");
+                  goto skip;
+               }
              ok = edje_object_file_set(blk->obj, path, blk->link);
           }
         if (!ok)
           {
-             snprintf(path, sizeof(path), "%s/objlib/%s",
-                      elm_app_data_dir_get(), blk->path);
+             if ((size_t)snprintf(path, sizeof(path), "%s/objlib/%s",
+                                  elm_app_data_dir_get(), blk->path)
+                 >= sizeof(path))
+               {
+                  ERR("Not enough space in buffer for path to edje lib file");
+                  goto skip;
+               }
              ok = edje_object_file_set(blk->obj, path, blk->link);
           }
      }
+skip:
    evas_object_smart_member_add(blk->obj, obj);
    evas_object_stack_above(blk->obj, sd->event);
    evas_object_show(blk->obj);

-- 


Reply via email to