From: jiung.yu@samsung.com Date: Wed, 19 Sep 2018 01:47:30 +0000 (+0900) Subject: Fix bugs reported by static analyzer X-Git-Tag: accepted/tizen/4.0/unified/20181001.035901^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8bb2dcc494a65a94cb7daa2edbe0e8105966389c;p=platform%2Fcore%2Fconnectivity%2Fasp-manager.git Fix bugs reported by static analyzer Change-Id: I0907ab7eabfd26acbdd44aea18ad768e9627d651 Signed-off-by: Yu jiung --- diff --git a/packaging/asp-manager.spec b/packaging/asp-manager.spec index b9148a2..c938263 100755 --- a/packaging/asp-manager.spec +++ b/packaging/asp-manager.spec @@ -1,6 +1,6 @@ Name: asp-manager Summary: ASP(application service platform) manager -Version: 0.0.32 +Version: 0.0.33 Release: 1 Group: Network & Connectivity/Other License: Apache-2.0 diff --git a/src/asp-manager.c b/src/asp-manager.c index 30aff54..04d08a7 100755 --- a/src/asp-manager.c +++ b/src/asp-manager.c @@ -66,7 +66,8 @@ static void __session_request_cb(gint32 error_code, guint8 *session_mac, if (info_length != 0) { session_info_str = g_try_malloc0(info_length + 1); - memcpy(session_info_str, session_info, info_length); + if (session_info_str) + memcpy(session_info_str, session_info, info_length); } g_snprintf(session_mac_str, MACSTR_LEN + 1, MACSTR, MAC2STR(session_mac)); diff --git a/src/session/asp-p2p-conn.c b/src/session/asp-p2p-conn.c index 41ec6e0..bfb4f13 100644 --- a/src/session/asp-p2p-conn.c +++ b/src/session/asp-p2p-conn.c @@ -108,7 +108,8 @@ void asp_p2p_conn_connect_session(const guint8 *session_mac, guint32 session_id, params.network_config = network_config; if (info_length != 0) { params.session_information = g_try_malloc0(info_length + 1); - memcpy(params.session_information, session_info, info_length); + if (params.session_information) + memcpy(params.session_information, session_info, info_length); } res = asp_tech_connect_session(ASP_TECH_P2P, ¶ms); diff --git a/src/tech/asp-tech-p2p.c b/src/tech/asp-tech-p2p.c index a9970c6..7d763c0 100755 --- a/src/tech/asp-tech-p2p.c +++ b/src/tech/asp-tech-p2p.c @@ -470,7 +470,8 @@ void asp_tech_p2p_process_session_request(GDBusConnection *connection, info_length = strlen(str); g_free(session_info); session_info = g_try_malloc0(info_length + 1); - memcpy(session_info, str, info_length); + if (session_info) + memcpy(session_info, str, info_length); } else { ;/* Do Nothing */ }