wpa_supplicant/scan.c
struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
					     u32 vendor_type)
{
	struct wpabuf *buf;
	const u8 *end, *pos;

	buf = wpabuf_alloc(res->ie_len);
	if (buf == NULL)
		return NULL;

	pos = (const u8 *) (res + 1);
	end = pos + res->ie_len;

	while (end - pos > 1) {
		if (2 + pos[1] > end - pos)
			break;
		if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
		    vendor_type == WPA_GET_BE32(&pos[2]))
			wpabuf_put_data(buf, pos + 2 + 4, pos[1] - 4);
		pos += 2 + pos[1];
	}

	if (wpabuf_len(buf) == 0) {
		wpabuf_free(buf);
		buf = NULL;
	}

	return buf;
}
/**
 * wpa_scan_get_vendor_ie_multi - Fetch vendor IE data from a scan result
 * @res: Scan result entry
 * @vendor_type: Vendor type (four octets starting the IE payload)
 * Returns: Pointer to the information element payload or %NULL if not found
 *
 * This function returns concatenated payload of possibly fragmented vendor
 * specific information elements in the scan result. The caller is responsible
 * for freeing the returned buffer.
 */
Fetch vendor IE data from a scan result
@res: Scan result entry
@vendor_type: Vendor type (four octets starting the IE payload)
Returns: Pointer to the information element payload or %NULL if not found

This function returns concatenated payload of possibly fragmented vendor
specific information elements in the scan result. The caller is responsible
for freeing the returned buffer.
Fetch vendor IE data from a scan result @res : Scan result entry @vendor_type : Vendor type ( four octets starting the IE payload ) Returns : Pointer to the information element payload or %NULL if not found This function returns concatenated payload of possibly fragmented vendor specific information elements in the scan result . The caller is responsible for freeing the returned buffer .
struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
					     u32 vendor_type)
{
	struct wpabuf *buf;
	const u8 *end, *pos;
	buf = wpabuf_alloc(res->ie_len);
	if (buf == NULL)
		return NULL;
	pos = (const u8 *) (res + 1);
	end = pos + res->ie_len;
	while (end - pos > 1) {
		if (2 + pos[1] > end - pos)
			break;
		if (pos[0] == WLAN_EID_VENDOR_SPECIFIC && pos[1] >= 4 &&
		    vendor_type == WPA_GET_BE32(&pos[2]))
			wpabuf_put_data(buf, pos + 2 + 4, pos[1] - 4);
		pos += 2 + pos[1];
	}
	if (wpabuf_len(buf) == 0) {
		wpabuf_free(buf);
		buf = NULL;
	}
	return buf;
}
struct wpabuf * wpa_scan_get_vendor_ie_multi ( const struct wpa_scan_res * res , u32 vendor_type ) { struct wpabuf * buf ; const u8 * end , * pos ; buf = wpabuf_alloc ( res -> ie_len ) ; if ( buf == NULL ) return NULL ; pos = ( const u8 * ) ( res + 1 ) ; end = pos + res -> ie_len ; while ( end - pos > 1 ) { if ( 2 + pos [ 1 ] > end - pos ) break ; if ( pos [ 0 ] == WLAN_EID_VENDOR_SPECIFIC && pos [ 1 ] >= 4 && vendor_type == WPA_GET_BE32 ( & pos [ 2 ] ) ) wpabuf_put_data ( buf , pos + 2 + 4 , pos [ 1 ] - 4 ) ; pos += 2 + pos [ 1 ] ; } if ( wpabuf_len ( buf ) == 0 ) { wpabuf_free ( buf ) ; buf = NULL ; } return buf ; }
wpa_scan_get_vendor_ie_multi - Fetch vendor IE data from a scan result
 @res: Scan result entry
 @vendor_type: Vendor type (four octets starting the IE payload)
 Returns: Pointer to the information element payload or %NULL if not found
wpa_scan_get_vendor_ie_multi - Fetch vendor IE data from a scan result @res : Scan result entry @vendor_type : Vendor type ( four octets starting the IE payload ) Returns : Pointer to the information element payload or %NULL if not found