From bed0ec262dd858d6ddf89ef64712d7cf87f878ab Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Wed, 23 Mar 2016 15:08:26 +0530 Subject: [PATCH] In __ws_segment_to_service, max len can be 255 This patch fixes the false comparision statement because __ws_hex_to_num(ptr, 2) can return max 0xff which is 255. and comparision was made between return of __ws_hex_to_num(ptr, 2) with 0xffff which is wrong. This comparision should be with 0xff. Change-Id: Iaadbfa7ce002de382fd7e0356d53e89454eac9a6 Signed-off-by: Nishant Chaprana --- packaging/wifi-direct-manager.spec | 2 +- .../wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packaging/wifi-direct-manager.spec b/packaging/wifi-direct-manager.spec index c00c7bc..ec22331 100755 --- a/packaging/wifi-direct-manager.spec +++ b/packaging/wifi-direct-manager.spec @@ -1,6 +1,6 @@ Name: wifi-direct-manager Summary: Wi-Fi Direct manger -Version: 1.2.149 +Version: 1.2.150 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c index 6d84537..60bfd51 100755 --- a/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c +++ b/plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c @@ -283,12 +283,12 @@ static int __ws_segment_to_service(char *segment, wfd_oem_new_service_s **servic while (*ptr != 0 && strncmp(ptr, "c0", 2)) { len = __ws_hex_to_num(ptr, 2); - ptr +=2; - if (len && len <= 0xffff) { + ptr += 2; + if (len && len <= 0xff) { temp = (char*) calloc(1, len+2); if (temp) { temp[0] = '.'; - for (i=0; i