Fix to use snprintf() instead of memcpy() 24/122324/2 accepted/tizen/common/20170331.152824 accepted/tizen/ivi/20170331.083322 accepted/tizen/mobile/20170331.083442 accepted/tizen/tv/20170331.083304 accepted/tizen/unified/20170331.083624 accepted/tizen/wearable/20170331.083408 submit/tizen/20170331.065508
authorWootak Jung <wootak.jung@samsung.com>
Fri, 31 Mar 2017 05:21:32 +0000 (14:21 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 31 Mar 2017 06:38:31 +0000 (15:38 +0900)
- Ensure null termination

Change-Id: Ie6df91619fe0a6a2aead32d5855b52a135de1be3

packaging/tel-plugin-dbus_tapi.spec
src/dtapi_sat_manager.c

index 35e95e4..80ffc1c 100644 (file)
@@ -1,6 +1,6 @@
 %define major 0
 %define minor 3
-%define patchlevel 81
+%define patchlevel 82
 
 Name:           tel-plugin-dbus_tapi
 Version:        %{major}.%{minor}.%{patchlevel}
index eef7871..49b31dc 100644 (file)
@@ -3657,7 +3657,7 @@ static gboolean _sat_manager_handle_send_ussd_result(struct custom_data *ctx, Tc
                                        memset(tr->terminal_rsp_data.send_ussd.text.string, 0x00,
                                                sizeof(tr->terminal_rsp_data.send_ussd.text.string));
                                        if (packed_data) {
-                                               memcpy((void*)tr->terminal_rsp_data.send_ussd.text.string, packed_data, strlen(packed_data));
+                                               snprintf(tr->terminal_rsp_data.send_ussd.text.string, strlen(packed_data) + 1, "%s", packed_data);
                                                tr->terminal_rsp_data.send_ussd.text.string_length = strlen(packed_data);
                                                g_free(packed_data);
                                        }
@@ -4059,7 +4059,8 @@ static gboolean sat_manager_handle_open_channel_result(struct custom_data *ctx,
                tr->terminal_rsp_data.open_channel.bearer_desc.bearer_parameter.local_link_bearer_param.service_type = service_type;
 
                if (service_record) {
-                       memcpy(tr->terminal_rsp_data.open_channel.bearer_desc.bearer_parameter.local_link_bearer_param.service_record, service_record, strlen(service_record));
+                       snprintf(tr->terminal_rsp_data.open_channel.bearer_desc.bearer_parameter.local_link_bearer_param.service_record,
+                               strlen(service_record) + 1, "%s", service_record);
                        g_free(service_record);
                }
        } break;
@@ -5046,7 +5047,7 @@ static gboolean _sat_manager_handle_get_input_confirm(struct custom_data *ctx, T
                                packed_data = (char*) tcore_util_pack_gsm7bit((const unsigned char *)tmp_str, tmp_len);
 
                                if (packed_data) {
-                                       memcpy((void*)tr->terminal_rsp_data.get_input.text.string, packed_data, strlen(packed_data));
+                                       snprintf(tr->terminal_rsp_data.get_input.text.string, strlen(packed_data) + 1, "%s", packed_data);
                                        tr->terminal_rsp_data.get_input.text.string_length = strlen(packed_data);
 
                                        g_free(packed_data);