diff mbox

[v2,2/2] ctrl_iface: BSS cmd skip info items if parsing fails

Message ID 1465900278-23309-1-git-send-email-jonathan@wizery.com
State Accepted
Headers show

Commit Message

Jonathan Afek June 14, 2016, 10:31 a.m. UTC
In some cases parsing of the mesh scan info for a BSS or
the P2P scan info can fail. One reason can be that the
beacon contained malformed length vendor IEs which are not
parsed when adding to the BSS table. Instead of skipping
the whole BSS of the BSS command, just skip the part
that failed to parse.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
---
 wpa_supplicant/ctrl_iface.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Jouni Malinen June 19, 2016, 9:59 p.m. UTC | #1
On Tue, Jun 14, 2016 at 01:31:18PM +0300, Jonathan Afek wrote:
> In some cases parsing of the mesh scan info for a BSS or
> the P2P scan info can fail. One reason can be that the
> beacon contained malformed length vendor IEs which are not
> parsed when adding to the BSS table. Instead of skipping
> the whole BSS of the BSS command, just skip the part
> that failed to parse.

Thanks, applied.
diff mbox

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 401cd61..920f592 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -4298,9 +4298,10 @@  static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 	if (mask & WPA_BSS_MASK_P2P_SCAN) {
 		ie = (const u8 *) (bss + 1);
 		ret = wpas_p2p_scan_result_text(ie, bss->ie_len, pos, end);
-		if (ret < 0 || ret >= end - pos)
+		if (ret >= end - pos)
 			return 0;
-		pos += ret;
+		if (ret > 0)
+			pos += ret;
 	}
 #endif /* CONFIG_P2P */
 
@@ -4381,9 +4382,10 @@  static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 	if (mask & WPA_BSS_MASK_MESH_SCAN) {
 		ie = (const u8 *) (bss + 1);
 		ret = wpas_mesh_scan_result_text(ie, bss->ie_len, pos, end);
-		if (ret < 0 || ret >= end - pos)
+		if (ret >= end - pos)
 			return 0;
-		pos += ret;
+		if (ret > 0)
+			pos += ret;
 	}
 #endif /* CONFIG_MESH */