seoz pushed a commit to branch master.

http://git.enlightenment.org/tools/elm-theme-viewer.git/commit/?id=54999c9d10e97f9a30f6fd81ae64bce46bfb2488

commit 54999c9d10e97f9a30f6fd81ae64bce46bfb2488
Author: Daniel Juyung Seo <[email protected]>
Date:   Fri Apr 25 15:14:48 2014 +0900

    theme/widget/widget_style: fixed buffer not null terminated bug.
    
    This fixes coverity CID 1205003, 1205004, 1205005, 1205006, 1205007,
     1205008, 1205009, 1205010.
---
 src/bin/theme.c        |  2 +-
 src/bin/widget.c       | 10 +++++-----
 src/bin/widget_style.c |  4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/bin/theme.c b/src/bin/theme.c
index 4e2f12a..59712ba 100644
--- a/src/bin/theme.c
+++ b/src/bin/theme.c
@@ -87,7 +87,7 @@ theme_load(const char *edje_file)
 
    EINA_LIST_FOREACH(groups, l, group)
      {
-        strncpy(buf, group, sizeof(buf));
+        strncpy(buf, group, sizeof(buf) - 1);
 
         token = strtok(buf, "/");
         if (strncmp("elm", token, 5))
diff --git a/src/bin/widget.c b/src/bin/widget.c
index f770f84..63fb65c 100644
--- a/src/bin/widget.c
+++ b/src/bin/widget.c
@@ -460,7 +460,7 @@ _widget_ews_create(Evas_Object *parent, const char 
*orig_style)
    const char *group = NULL, *style = NULL;
    char buf[PATH_MAX] = {0, };
 
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    group = strtok(buf, "/");
    style = strtok(NULL, "/");
 
@@ -673,7 +673,7 @@ _widget_gengrid_create(Evas_Object *parent, const char 
*orig_style, const char *
    ic->func.del = NULL;
 
    /* check for gengrid style or gengrid item style */
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    if ((gst == GENGRID_H9_GRID_CHECK_STYLE) ||
        (gst == GENGRID_GROUP_INDEX_STYLE) ||
        (gst == GENGRID_H9_GROUP_INDEX_STYLE))
@@ -826,7 +826,7 @@ _widget_genlist_create(Evas_Object *parent, const char 
*orig_style, const char *
    ic->func.state_get = NULL;
    ic->func.del = NULL;
 
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    token = strtok(buf, "/");
 
    /* set item or genlist style */
@@ -1654,7 +1654,7 @@ _widget_progressbar_create(Evas_Object *parent, const 
char *style2)
    EXPAND(o); FILL(o);
    evas_object_show(o);
 
-   strncpy(buf, style2, sizeof(buf));
+   strncpy(buf, style2, sizeof(buf) - 1);
    style = strtok(buf, "/");
    if (!strcmp("vertical", style))
      elm_progressbar_horizontal_set(o, EINA_FALSE);
@@ -1753,7 +1753,7 @@ _widget_separator_create(Evas_Object *parent, const char 
*orig_style)
    char buf[PATH_MAX] = {0, };
    const char *type;
 
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    type = strtok(buf, "/");
    //INF("%s", type);
 
diff --git a/src/bin/widget_style.c b/src/bin/widget_style.c
index 478bf5d..bb1769e 100644
--- a/src/bin/widget_style.c
+++ b/src/bin/widget_style.c
@@ -13,7 +13,7 @@ _style_split_1(const char *orig_style, char style[PATH_MAX])
    char buf[PATH_MAX] = {0, };
    const char *tok_ptr;
 
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    tok_ptr = strtok(buf, "/");
    strcpy(style, tok_ptr);
    //INF("%s", style);
@@ -33,7 +33,7 @@ _style_split_2(const char *orig_style)
    char buf[PATH_MAX] = {0, };
    const char *style;
 
-   strncpy(buf, orig_style, sizeof(buf));
+   strncpy(buf, orig_style, sizeof(buf) - 1);
    strtok(buf, "/");
    style = strtok(NULL, "/");
    //INF("%s", style);

-- 


Reply via email to