check if buffer size is too small strunc was truncated

This commit is contained in:
Carsten Haitzler 2018-11-16 12:47:16 +00:00
parent 80e36857a2
commit b389ed2b89
1 changed files with 15 additions and 4 deletions

View File

@ -2077,17 +2077,28 @@ _block_edje_activate(Evas_Object *obj, Termblock *blk)
if (homedir_get(home, sizeof(home))) if (homedir_get(home, sizeof(home)))
{ {
snprintf(path, sizeof(path), "%s/.terminology/objlib/%s", if ((size_t)snprintf(path, sizeof(path),
home, blk->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); ok = edje_object_file_set(blk->obj, path, blk->link);
} }
if (!ok) if (!ok)
{ {
snprintf(path, sizeof(path), "%s/objlib/%s", if ((size_t)snprintf(path, sizeof(path), "%s/objlib/%s",
elm_app_data_dir_get(), blk->path); 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); ok = edje_object_file_set(blk->obj, path, blk->link);
} }
} }
skip:
evas_object_smart_member_add(blk->obj, obj); evas_object_smart_member_add(blk->obj, obj);
evas_object_stack_above(blk->obj, sd->event); evas_object_stack_above(blk->obj, sd->event);
evas_object_show(blk->obj); evas_object_show(blk->obj);