[Fix][stack-buffer-overflow] Use gboolean when using g_variant_get for boolean. 45/184945/1 accepted/tizen/unified/20180726.064923 submit/tizen/20180725.233100
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 24 Jul 2018 10:42:45 +0000 (16:12 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 24 Jul 2018 10:46:35 +0000 (16:16 +0530)
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 <n.chaprana@samsung.com>
packaging/capi-network-wifi-direct.spec
src/wifi-direct-client-proxy.c

index dc91a1299236fae60784c2ae25ff14fd92400f16..c02fabf6bc996dc6ccd65bacd6b2b9d8ea278665 100644 (file)
@@ -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
index c7a7298ff042a821a8c72df09d957b754fd63635..5e3123cf6af4cfc84bc752a6f054d49ccb7c47af 100644 (file)
@@ -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");