use strncat instead of strcat (prevent: 456955) 18/49418/2
authorMinkyu Kang <mk7.kang@samsung.com>
Tue, 13 Oct 2015 05:45:20 +0000 (14:45 +0900)
committerMinkyu Kang <mk7.kang@samsung.com>
Tue, 13 Oct 2015 06:38:10 +0000 (15:38 +0900)
Change-Id: Ieef0ed3f49bd566ca399a480a90f40f3d3c49e54
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
src/data/albumdata.c
src/data/folderdata.c
src/data/mediadata.c
src/view/detail.c

index a0497c5..9b2ff52 100644 (file)
@@ -98,16 +98,14 @@ static bool _create_filter(struct albumdata *ad, filter_h *filter,
 
                snprintf(s1, sizeof(s1), " AND MEDIA_STORAGE_TYPE=%d",
                                        ad->source_type);
-
-               strcat(buf, s1);
+               strncat(buf, s1, strlen(s1));
        }
 
        if (cond) {
                char s2[64];
 
                snprintf(s2, sizeof(s2), " AND %s", cond);
-
-               strcat(buf, s2);
+               strncat(buf, s2, strlen(s2));
        }
 
        media_filter_set_condition(tmp_filter, buf,
index d9ef0e4..201d7d7 100644 (file)
@@ -95,16 +95,14 @@ static bool _create_filter(struct folderdata *fd, filter_h *filter,
 
                        snprintf(s1, sizeof(s1), " AND MEDIA_STORAGE_TYPE=%d",
                                                fd->source_type);
-
-                       strcat(buf, s1);
+                       strncat(buf, s1, strlen(s1));
                }
 
                if (cond) {
                        char s2[256];
 
                        snprintf(s2, sizeof(s2), " AND %s", cond);
-
-                       strcat(buf, s2);
+                       strncat(buf, s2, strlen(s2));
                }
 
                media_filter_set_order(tmp_filter, MEDIA_CONTENT_ORDER_ASC,
@@ -369,7 +367,7 @@ static bool _get_folder_list(struct folderdata *fd, char **path)
                                        fd->parent_id);
                }
 
-               strcat(buf, s);
+               strncat(buf, s, strlen(s));
        }
 
        if (!_get_sub_folder_list(fd, buf)) {
index c55572c..eb0ae3a 100644 (file)
@@ -120,8 +120,7 @@ static bool _create_filter(struct mediadata *md, filter_h *filter)
 
                snprintf(s, sizeof(s), " AND MEDIA_STORAGE_TYPE=%d",
                                        md->source_type);
-
-               strcat(buf, s);
+               strncat(buf, s, strlen(s));
        }
 
        media_filter_set_condition(tmp_filter, buf,
index a182fb0..629f210 100644 (file)
@@ -627,7 +627,7 @@ static void _get_place_title(const char *title, char *str, int size)
 
        if (country) {
                snprintf(s, sizeof(s), ", %s", country);
-               strcat(str, s);
+               strncat(str, s, strlen(s));
        }
 }