Edje: fix invalid read on edje embryo get_part_id
authorbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 20 Jun 2011 21:59:31 +0000 (21:59 +0000)
committerbdilly <bdilly@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 20 Jun 2011 21:59:31 +0000 (21:59 +0000)
It was expecting for a null terminator. But that wasn't the
case. Using parts_count instead.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@60537 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_embryo.c

index e0c5f7d..7575cca 100644 (file)
@@ -807,6 +807,7 @@ _edje_embryo_fn_get_part_id(Embryo_Program *ep, Embryo_Cell *params)
    Edje_Part_Collection *col;
    Edje_Part **part;
    char *p;
+   unsigned int i;
 
    CHKPARAM(1);
    ed = embryo_program_data_get(ep);
@@ -814,7 +815,8 @@ _edje_embryo_fn_get_part_id(Embryo_Program *ep, Embryo_Cell *params)
    if (!p) return -1;
    col = ed->collection;
    if (!col) return -1;
-   for (part = col->parts; *part; part++)
+   part = col->parts;
+   for (i = 0; i < col->parts_count; i++, part++)
      {
         if (!(*part)->name) continue;
         if (!strcmp((*part)->name, p)) return (*part)->id;