diff options
author | Younho Park <younho.park@samsung.com> | 2017-09-21 15:02:49 +0900 |
---|---|---|
committer | Younho Park <younho.park@samsung.com> | 2017-09-21 15:02:49 +0900 |
commit | 95938318250d9f5a5984cd646be910a3e155c6a0 (patch) | |
tree | edd88277767080cea6261254a8e7faea5d1129ed | |
parent | 74480b53f22f978cf2a11d31c0ca136b13543d4d (diff) | |
download | service-adaptor-accepted/tizen_unified.tar.gz service-adaptor-accepted/tizen_unified.tar.bz2 service-adaptor-accepted/tizen_unified.zip |
Fixed svace issuesubmit/tizen/20170921.060854accepted/tizen/unified/20170922.065143accepted/tizen_unified
Change-Id: Ie6e97a3b635cc81b896db9ad5a6c06c2b4c70282
Signed-off-by: Younho Park <younho.park@samsung.com>
-rw-r--r-- | adaptor/storage-adaptor/storage-adaptor.c | 11 | ||||
-rw-r--r-- | packaging/service-adaptor.spec | 2 | ||||
-rw-r--r-- | server/src/dbus/dbus-service-adaptor.c | 4 | ||||
-rw-r--r-- | server/src/dbus/dbus-storage-adaptor.c | 122 |
4 files changed, 72 insertions, 67 deletions
diff --git a/adaptor/storage-adaptor/storage-adaptor.c b/adaptor/storage-adaptor/storage-adaptor.c index 546fa83..07b24e0 100644 --- a/adaptor/storage-adaptor/storage-adaptor.c +++ b/adaptor/storage-adaptor/storage-adaptor.c @@ -1341,18 +1341,21 @@ storage_adaptor_file_info_h storage_adaptor_create_file_info(void) { storage_adaptor_file_info_h _file_info = NULL; _file_info = (storage_adaptor_file_info_h) calloc(1, sizeof(storage_adaptor_file_info_t)); + if (NULL == _file_info) + return NULL; storage_adaptor_media_meta_s *_media_meta = NULL; _media_meta = (storage_adaptor_media_meta_s *) calloc(1, sizeof(storage_adaptor_media_meta_s)); + if (NULL == _media_meta) { + free(_file_info); + return NULL; + } storage_adaptor_cloud_meta_s *_cloud_meta = NULL; _cloud_meta = (storage_adaptor_cloud_meta_s *) calloc(1, sizeof(storage_adaptor_cloud_meta_s)); - - if ((NULL == _file_info) || (NULL == _media_meta) || (NULL == _cloud_meta)) { + if (NULL == _cloud_meta) { free(_file_info); free(_media_meta); - free(_cloud_meta); - return NULL; } diff --git a/packaging/service-adaptor.spec b/packaging/service-adaptor.spec index ed8944d..5eaec13 100644 --- a/packaging/service-adaptor.spec +++ b/packaging/service-adaptor.spec @@ -1,6 +1,6 @@ Name: service-adaptor Summary: Service Adaptor Framework for Convergence -Version: 1.2.2 +Version: 1.2.3 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/server/src/dbus/dbus-service-adaptor.c b/server/src/dbus/dbus-service-adaptor.c index b843026..a6da042 100644 --- a/server/src/dbus/dbus-service-adaptor.c +++ b/server/src/dbus/dbus-service-adaptor.c @@ -105,7 +105,7 @@ FUNC_STEP(); service_adaptor_info("[DM] client profile <%s>", client_profile); char client_name[1024] = {0, }; int client_pid = 0; - int sr = sscanf(client_profile, "%s%d", client_name, &client_pid); + int sr = sscanf(client_profile, "%1000s %10d", client_name, &client_pid); if (sr == 2) { service_adaptor_info("[DM] client<%s> pid<%d>", client_name, client_pid); #ifndef DETAILED_PEER @@ -132,7 +132,7 @@ FUNC_END(); service_adaptor_info("[DM] client profile <%s>", client_profile); char client_name[1024] = {0, }; int client_pid = 0; - int sr = sscanf(client_profile, "%s%d", client_name, &client_pid); + int sr = sscanf(client_profile, "%1000s %10d", client_name, &client_pid); if (sr == 2) { service_adaptor_info("[DM][dis] client<%s> pid<%d>", client_name, client_pid); #ifndef DETAILED_PEER diff --git a/server/src/dbus/dbus-storage-adaptor.c b/server/src/dbus/dbus-storage-adaptor.c index 0e589ca..4d7ccff 100644 --- a/server/src/dbus/dbus-storage-adaptor.c +++ b/server/src/dbus/dbus-storage-adaptor.c @@ -807,65 +807,67 @@ GVariant *__create_get_file_list_res_type(storage_adaptor_file_info_h *file_info storage_adaptor_file_info_h _file_info = NULL; storage_adaptor_file_info_h dummy_file_info = storage_adaptor_create_file_info(); - for (gsize i = 0; i < file_info_len; i++) { - _file_info = file_info_list[i]; - if (NULL == _file_info) { - _file_info = dummy_file_info; - } - - if (NULL == _file_info->media_meta) { - _file_info->media_meta = dummy_file_info->media_meta; - } - - if (NULL == _file_info->cloud_meta) { - _file_info->cloud_meta = dummy_file_info->cloud_meta; - } - - g_variant_builder_open(builder_file_info, G_VARIANT_TYPE(service_adaptor_file_info_s_type)); - - /* file_info default */ - g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->plugin_uri)); - g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->object_id)); - g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->storage_path)); - g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->file_size); - g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->created_time); - g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->modified_time); - g_variant_builder_add(builder_file_info, "i", (int32_t) _file_info->file_info_index); - g_variant_builder_add(builder_file_info, "i", (int32_t) _file_info->content_type); - - /* media_meta */ - - g_variant_builder_add_value(builder_file_info, g_variant_new(service_adaptor_content_meta_s_type, - __safe_add_string(_file_info->media_meta->mime_type), - __safe_add_string(_file_info->media_meta->title), - __safe_add_string(_file_info->media_meta->album), - __safe_add_string(_file_info->media_meta->artist), - __safe_add_string(_file_info->media_meta->genere), - __safe_add_string(_file_info->media_meta->recorded_date), - (int32_t) _file_info->media_meta->width, - (int32_t) _file_info->media_meta->height, - (int32_t) _file_info->media_meta->duration, - __safe_add_string(_file_info->media_meta->copyright), - __safe_add_string(_file_info->media_meta->track_num), - __safe_add_string(_file_info->media_meta->description), - __safe_add_string(_file_info->media_meta->composer), - __safe_add_string(_file_info->media_meta->year), - (int32_t) _file_info->media_meta->bitrate, - (int32_t) _file_info->media_meta->samplerate, - (int32_t) _file_info->media_meta->channel, - __safe_add_string(_file_info->media_meta->extra_media_meta))); - - /* cloud_meta */ - g_variant_builder_add_value(builder_file_info, g_variant_new(service_adaptor_cloud_meta_s_type, - __safe_add_string(_file_info->cloud_meta->service_name), - (uint64_t) _file_info->cloud_meta->usage_byte, - (uint64_t) _file_info->cloud_meta->quota_byte)); - - g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->extra_file_info)); - - g_variant_builder_close(builder_file_info); + if (NULL != dummy_file_info) { + for (gsize i = 0; i < file_info_len; i++) { + _file_info = file_info_list[i]; + if (NULL == _file_info) { + _file_info = dummy_file_info; + } + + if (NULL == _file_info->media_meta) { + _file_info->media_meta = dummy_file_info->media_meta; + } + + if (NULL == _file_info->cloud_meta) { + _file_info->cloud_meta = dummy_file_info->cloud_meta; + } + + g_variant_builder_open(builder_file_info, G_VARIANT_TYPE(service_adaptor_file_info_s_type)); + + /* file_info default */ + g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->plugin_uri)); + g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->object_id)); + g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->storage_path)); + g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->file_size); + g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->created_time); + g_variant_builder_add(builder_file_info, "t", (uint64_t) _file_info->modified_time); + g_variant_builder_add(builder_file_info, "i", (int32_t) _file_info->file_info_index); + g_variant_builder_add(builder_file_info, "i", (int32_t) _file_info->content_type); + + /* media_meta */ + + g_variant_builder_add_value(builder_file_info, g_variant_new(service_adaptor_content_meta_s_type, + __safe_add_string(_file_info->media_meta->mime_type), + __safe_add_string(_file_info->media_meta->title), + __safe_add_string(_file_info->media_meta->album), + __safe_add_string(_file_info->media_meta->artist), + __safe_add_string(_file_info->media_meta->genere), + __safe_add_string(_file_info->media_meta->recorded_date), + (int32_t) _file_info->media_meta->width, + (int32_t) _file_info->media_meta->height, + (int32_t) _file_info->media_meta->duration, + __safe_add_string(_file_info->media_meta->copyright), + __safe_add_string(_file_info->media_meta->track_num), + __safe_add_string(_file_info->media_meta->description), + __safe_add_string(_file_info->media_meta->composer), + __safe_add_string(_file_info->media_meta->year), + (int32_t) _file_info->media_meta->bitrate, + (int32_t) _file_info->media_meta->samplerate, + (int32_t) _file_info->media_meta->channel, + __safe_add_string(_file_info->media_meta->extra_media_meta))); + + /* cloud_meta */ + g_variant_builder_add_value(builder_file_info, g_variant_new(service_adaptor_cloud_meta_s_type, + __safe_add_string(_file_info->cloud_meta->service_name), + (uint64_t) _file_info->cloud_meta->usage_byte, + (uint64_t) _file_info->cloud_meta->quota_byte)); + + g_variant_builder_add(builder_file_info, "s", __safe_add_string(_file_info->extra_file_info)); + + g_variant_builder_close(builder_file_info); + } + storage_adaptor_destroy_file_info(&dummy_file_info); } - storage_adaptor_destroy_file_info(&dummy_file_info); GVariant *response = g_variant_new(MAKE_RETURN_TYPE(service_adaptor_get_file_list_res_s_type), builder_file_info, (uint32_t)file_info_len, @@ -1278,7 +1280,7 @@ void storage_adaptor_method_call(GDBusConnection *connection, char public_token[1024] = {0,}; char auth_code[1024] = {0,}; - sscanf(server_path, "%[^'?']?auth_code=%s", public_token, auth_code); + sscanf(server_path, "%1000[^'?']?auth_code=%1000s", public_token, auth_code); ret_code = storage_adaptor_download_file_sync_by_public_token(plugin, service->storage_context, public_token, auth_code, download_path, NULL, &error_code, NULL); @@ -1354,7 +1356,7 @@ void storage_adaptor_method_call(GDBusConnection *connection, char public_token[1024] = {0,}; char auth_code[1024] = {0,}; - sscanf(server_path, "%[^'?']?auth_code=%s", public_token, auth_code); + sscanf(server_path, "%1000[^'?']?auth_code=%1000s", public_token, auth_code); ret_code = storage_adaptor_download_file_async_by_public_token(plugin, service->storage_context, public_token, auth_code, download_path, NULL, (void *) &fd, &error_code); |