From: Jonathan Afek Date: Tue, 14 Jun 2016 10:31:18 +0000 (+0300) Subject: ctrl_iface: BSS command to skip info items if parsing fails X-Git-Tag: hostap_2_6~362 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3b208346ec56342fda736e62601df485ed002493;p=thirdparty%2Fhostap.git ctrl_iface: BSS command to skip info items if parsing fails 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/Probe Response frame 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 --- diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index e75f1ae44..eb1e40a88 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 */