From: Nishant Chaprana Date: Tue, 24 Jul 2018 10:42:45 +0000 (+0530) Subject: [Fix][stack-buffer-overflow] Use gboolean when using g_variant_get for boolean. X-Git-Tag: submit/tizen/20180725.233100^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f5a9f06c6a68c448944ab7e1b3d722bde9ffeef7;p=platform%2Fcore%2Fapi%2Fwifi-direct.git [Fix][stack-buffer-overflow] Use gboolean when using g_variant_get for boolean. Description: g_variant_get API expects reference of gboolean variable in third parameter, and we arepassing reference of bool variable. As per Glib's documentation, gboolean is typecast of int. ================================================================= (Reference: https://people.gnome.org/~desrt/glib-docs/glib-Basic-Types.html#gboolean) gboolean typedef gint gboolean; A standard boolean type. Variables of this type should only contain the value TRUE or FALSE. ================================================================= Change-Id: I89ee1d9e367efec6355d31837d3efbcb13d0fabb Signed-off-by: Nishant Chaprana --- diff --git a/packaging/capi-network-wifi-direct.spec b/packaging/capi-network-wifi-direct.spec index dc91a12..c02fabf 100644 --- a/packaging/capi-network-wifi-direct.spec +++ b/packaging/capi-network-wifi-direct.spec @@ -3,7 +3,7 @@ Name: capi-network-wifi-direct Summary: Network WiFi-Direct Library -Version: 1.2.94 +Version: 1.2.95 Release: 1 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index c7a7298..5e3123c 100644 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -854,7 +854,7 @@ int wifi_direct_initialize(void) GError* error = NULL; GVariant *reply = NULL; bool wifi_direct_enable; - bool val; + gboolean val; int res = 0; if (g_client_info.is_registered == TRUE) { @@ -2175,7 +2175,7 @@ int wifi_direct_is_group_owner(bool *owner) GError* error = NULL; GVariant *reply = NULL; int ret = WIFI_DIRECT_ERROR_NONE; - bool val; + gboolean val; if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered"); @@ -2216,7 +2216,7 @@ int wifi_direct_is_autonomous_group(bool *autonomous_group) GError* error = NULL; GVariant *reply = NULL; int ret = WIFI_DIRECT_ERROR_NONE; - bool val; + gboolean val; if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered"); @@ -3310,6 +3310,7 @@ int wifi_direct_is_discoverable(bool* discoverable) GError* error = NULL; GVariant *reply = NULL; + gboolean val; int ret = WIFI_DIRECT_ERROR_NONE; if (g_client_info.is_registered == false) { @@ -3331,7 +3332,8 @@ int wifi_direct_is_discoverable(bool* discoverable) if (ret != WIFI_DIRECT_ERROR_NONE) return ret; - g_variant_get(reply, "(b)", discoverable); + g_variant_get(reply, "(b)", &val); + *discoverable = val; WDC_LOGD("Discoverable = [%s]", *discoverable ? "Yes" : "No"); WDC_LOGD("%s() SUCCESS", __func__); @@ -3350,6 +3352,7 @@ int wifi_direct_is_listening_only(bool* listen_only) GError* error = NULL; GVariant *reply = NULL; int ret = WIFI_DIRECT_ERROR_NONE; + gboolean val; if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered"); @@ -3370,7 +3373,8 @@ int wifi_direct_is_listening_only(bool* listen_only) if (ret != WIFI_DIRECT_ERROR_NONE) return ret; - g_variant_get(reply, "(b)", listen_only); + g_variant_get(reply, "(b)", &val); + *listen_only = val; WDC_LOGD("Is listen only = [%s]", *listen_only ? "Yes" : "No"); WDC_LOGD("%s() SUCCESS", __func__); @@ -3582,7 +3586,7 @@ int wifi_direct_is_persistent_group_enabled(bool *enabled) GError* error = NULL; GVariant *reply = NULL; int ret = WIFI_DIRECT_ERROR_NONE; - bool val; + gboolean val; if (g_client_info.is_registered == false) { WDC_LOGE("Client is NOT registered");