Fix memory corruption issue 84/73484/1 accepted/tizen/common/20160613.144912 accepted/tizen/ivi/20160613.123539 accepted/tizen/mobile/20160613.123711 accepted/tizen/tv/20160613.123524 accepted/tizen/wearable/20160613.123601 submit/tizen/20160613.070227
authorMinje Ahn <minje.ahn@samsung.com>
Wed, 8 Jun 2016 08:35:33 +0000 (17:35 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Wed, 8 Jun 2016 08:35:33 +0000 (17:35 +0900)
Change-Id: I8f28ca106ab1146ec0038bd5d6414dbd32493c6e
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
src/media_playlist.c

index 61a670e..bf4e9ca 100755 (executable)
@@ -313,6 +313,7 @@ static int __media_playlist_import_item_from_file(const char* playlist_path, cha
                        }
 
                        (*item_list)[current_index] = malloc(tmp_str_len + 1);
+                       memset((*item_list)[current_index], 0, tmp_str_len + 1);
                        if ((*item_list)[current_index] == NULL) {
                                __media_playlist_destroy_import_item(*item_list, current_index);
                                SAFE_FREE(buf);
@@ -320,12 +321,12 @@ static int __media_playlist_import_item_from_file(const char* playlist_path, cha
                                media_content_error("Out of Memory");
                                return MEDIA_CONTENT_ERROR_OUT_OF_MEMORY;
                        }
-                       memmove((*item_list)[current_index], tmp_str, tmp_str_len + 1);
+                       memmove((*item_list)[current_index], tmp_str, tmp_str_len);
 
                        current_index += 1;
                }
 
-               tmp_buf += (tmp_str_len + 1);
+               tmp_buf += (tmp_str_len);
        }
 
        *item_count = current_index;