Fixed security 3rd vulnerability issues. 86/211986/1
authorsaerome.kim <saerome.kim@samsung.com>
Tue, 13 Aug 2019 03:54:56 +0000 (12:54 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Tue, 13 Aug 2019 06:07:57 +0000 (15:07 +0900)
Change-Id: I8857c60b9f424d927440c07cd96e014263bc977d
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
packaging/ua-manager.spec
ua-api/src/ua-api.c
ua-api/src/ua-event-handler.c
ua-api/src/ua-request-sender.c
ua-daemon/src/ua-manager-core.c

index cae5fba..fd8da8b 100644 (file)
@@ -1,6 +1,6 @@
 Name:       ua-manager
 Summary:    User awareness manager
-Version:    0.6.1
+Version:    0.6.2
 Release:    1
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
index 57e1332..6cf84e6 100644 (file)
@@ -415,7 +415,7 @@ UAM_EXPORT_API int _uam_request_remove_device_by_mac(const char *mac)
        UAM_INIT_PARAMS();
        UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
-       g_strlcpy(str, mac, UAM_DEVICE_ID_MAX_STRING_LEN);
+       g_strlcpy(str, mac, sizeof(str));
        g_array_append_vals(in_param1, str, sizeof(str));
        ret = _uam_sync_request(UAM_REQUEST_DELETE_DEVICE_BY_MAC,
                        in_param1, in_param2, in_param3, in_param4, &out_param);
@@ -475,7 +475,7 @@ UAM_EXPORT_API int _uam_request_get_device_by_mac(const char *mac,
        UAM_INIT_PARAMS();
        UAM_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
 
-       g_strlcpy(str, mac, UAM_DEVICE_ID_MAX_STRING_LEN);
+       g_strlcpy(str, mac, sizeof(str));
        g_array_append_vals(in_param1, str, sizeof(str));
        ret = _uam_sync_request(UAM_REQUEST_GET_DEVICE_BY_MAC,
                        in_param1, in_param2, in_param3, in_param4, &out_param);
index 74b5367..e3233d1 100644 (file)
@@ -304,11 +304,16 @@ int _uam_register_event_handler(uam_event_cb event_cb, void *user_data)
        retv_if(NULL == conn, UAM_ERROR_INTERNAL);
 
        event_handler_data = g_malloc0(sizeof(uam_event_handler_data_t));
-       event_handler_data->cb = event_cb;
-       event_handler_data->user_data = user_data;
-       event_handler_data->id = g_dbus_connection_signal_subscribe(conn,
-                       NULL, interface, NULL, path, NULL, 0,
-                       event_func, event_handler_data, NULL);
+       if (event_handler_data) {
+               event_handler_data->cb = event_cb;
+               event_handler_data->user_data = user_data;
+               event_handler_data->id = g_dbus_connection_signal_subscribe(conn,
+               NULL, interface, NULL, path, NULL, 0,
+               event_func, event_handler_data, NULL);
+       } else {
+               UAM_ERR("Memory allocation error");
+               return UAM_ERROR_OUT_OF_MEMORY;
+       }
 
        is_registered = TRUE;
 
index 30ef528..d46b5a2 100644 (file)
@@ -349,10 +349,14 @@ int _uam_async_request(
        retv_if(NULL == proxy, UAM_ERROR_INTERNAL);
 
        req_info = g_malloc0(sizeof(uam_req_info_t));
-       req_info->req_func = req_func;
-       req_info->cb = callback;
-       req_info->user_data = user_data;
-
+       if (req_info) {
+               req_info->req_func = req_func;
+               req_info->cb = callback;
+               req_info->user_data = user_data;
+       } else {
+               UAM_ERR("Memory allocation error");
+               return UAM_ERROR_OUT_OF_MEMORY;
+       }
        param1 = g_variant_new_from_data((const GVariantType *)"ay",
                        in_param1->data, in_param1->len,
                        TRUE, NULL, NULL);
index 8046840..8fb62aa 100644 (file)
@@ -1810,10 +1810,15 @@ static int __uam_core_start_detection(int detection_type,
        monitor = __uam_find_monitor(monitors, sender, svc_name, detection_type);
        if (!monitor) {
                monitor = g_malloc0(sizeof(uam_monitor_info_t));
-               monitor->name = g_strdup(sender);
-               monitor->mode = detection_type;
-               monitor->service = service;
-               is_monitor_added = FALSE;
+               if (monitor) {
+                       monitor->name = g_strdup(sender);
+                       monitor->mode = detection_type;
+                       monitor->service = service;
+                       is_monitor_added = FALSE;
+               } else {
+                       UAM_ERR("Memory allocation error");
+                       return UAM_ERROR_OUT_OF_MEMORY;
+               }
        }
 
        UAM_DBG("Name: %s, Service: %s, Mode: %d", monitor->name, svc_name, monitor->mode);