Fix memory copy function with string copy function 05/87405/3
authorYu Jiung <jiung.yu@samsung.com>
Wed, 7 Sep 2016 11:18:12 +0000 (20:18 +0900)
committerJiung Yu <jiung.yu@samsung.com>
Fri, 9 Sep 2016 05:30:58 +0000 (22:30 -0700)
Change-Id: I3e245f092e8527061e8fbceb537048b585f5f67d
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/asp-manager.spec
src/session/asp-session.c

index 2e6641f..f3beb02 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       asp-manager
 Summary:    ASP(application service platform) manager
-Version:    0.0.3
+Version:    0.0.4
 Release:    2
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 7455f09..edfbc56 100644 (file)
@@ -776,14 +776,17 @@ void _p2p_conn_ip_assigned_cb(gint32 error_code, const guint8 *session_mac,
                              guint32 session_id, gchar *service_mac, gchar *peer_ip_addr, gint32 ip_length,
                              gpointer user_data)
 {
+       INFO_MSG;
+
        asp_session_s *session = _get_exist_session(session_id, session_mac);
 
        if (session) {
                ip_assigned_param_s *p_param = (ip_assigned_param_s *)g_malloc(sizeof(
                                                       ip_assigned_param_s));
-               memcpy(p_param->peer_ip_addr, peer_ip_addr, ip_length);
+               g_strlcpy(p_param->peer_ip_addr, peer_ip_addr, ASP_SESSION_IPV4_STR_LEN);
                p_param->length = ip_length;
 
+               ASP_LOGD("%s %d", p_param->peer_ip_addr, p_param->length);
                gfsm_process_event(session->context,
                                   gfsm_create_event(SESSION_EVENT_IP_ASSIGNED, p_param, g_free));
        }