copy the device name with correct buffer size 13/174413/3 accepted/tizen/unified/20180406.062051 submit/tizen/20180403.231154
authorMilind Murhekar <m.murhekar@samsung.com>
Mon, 2 Apr 2018 05:16:39 +0000 (10:46 +0530)
committerMilind Murhekar <m.murhekar@samsung.com>
Mon, 2 Apr 2018 06:13:36 +0000 (11:43 +0530)
Description: This patch corrects the copying
of device/peer name using destination size, as
g_strlcpy handles the null terminations internally.

Change-Id: I89b4149bf518a02478818071d9beeccb63b324e7
Signed-off-by: Milind Murhekar <m.murhekar@samsung.com>
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c

index 6116930..a48d894 100644 (file)
@@ -6,7 +6,7 @@
 
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.268
+Version:       1.2.269
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
index 2cee0a2..411743e 100644 (file)
@@ -695,7 +695,7 @@ static void __ws_get_peer_property(const char *key, GVariant *value, void *user_
                const char *name = NULL;
 
                g_variant_get(value, "&s", &name);
-               g_strlcpy(peer->dev_name, name, WS_SSID_LEN);
+               g_strlcpy(peer->dev_name, name, WS_SSID_LEN + 1);
                WDP_LOGD("Device name [%s]", peer->dev_name);
 
        } else if (g_strcmp0(key, "config_method") == 0) {
@@ -801,7 +801,7 @@ static void __ws_peer_property(const char *key, GVariant *value, void *user_data
                const char *name = NULL;
 
                g_variant_get(value, "&s", &name);
-               g_strlcpy(peer->name, name, WS_SSID_LEN);
+               g_strlcpy(peer->name, name, WS_SSID_LEN + 1);
                WDP_LOGD("Device Name [%s]", peer->name);
 
        } else if (g_strcmp0(key, "config_method") == 0) {