diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2014-03-03 13:53:28 -0800 |
|---|---|---|
| committer | Dmitry Shmidt <dimitrysh@google.com> | 2014-03-03 13:53:28 -0800 |
| commit | 7d5c8f257a74ac0d12828962a492e8b84ef83923 (patch) | |
| tree | 3478470f3e544cfe62930b2714ae2602f8bad2a9 /src | |
| parent | 4582d2a5dd8180c52eb95b1100fb183b9a289708 (diff) | |
| download | android_external_wpa_supplicant_8-7d5c8f257a74ac0d12828962a492e8b84ef83923.tar.gz android_external_wpa_supplicant_8-7d5c8f257a74ac0d12828962a492e8b84ef83923.tar.bz2 android_external_wpa_supplicant_8-7d5c8f257a74ac0d12828962a492e8b84ef83923.zip | |
Cumulative patch from commit 5f7e1c06cd428888a2ed4fa763c5da37a873e422
5f7e1c0 Redirect more frames with ext_mgmt_frame_handling=1
7738163 RADIUS server: Copy IPv4 address only when IPv6 is not used
508e24c dbus: Clean up error reporting for TDLS peer address parsing
3b6170b WPS: Remove duplicate variable setting
78789d9 Remove unnecessary variable initialization
a7c37d9 dbus: Remove duplicated variable assignment
e997bc7 Remove a static analyzer warning about unused variable write
ea3b8c1 Do not use a separate variable for tracking first entry in a list
8a4ce28 WPA: Clean up cipher suite counting in write routines
6ed626d Remove unused gid_str pointer update
749fa14 Debug print trailing WPA/RSN IE bytes, if any
a5802c0 OpenSSL: Avoid never-used analyzer warning
7b6e815 Clean up hostapd add_iface error path operations
67adcd2 WNM: Check wpa_s->current_bss more consistently
3ff8073 EAP-FAST: Use clear eap_get_config() result validation
a8716d1 roboswitch: Verify that register read succeeds before comparing res
3d91a04 DFS: Make sure center frequency is always initialized for VHT
fa0a9f5 trace: Fix memory use on no-function name path
bd27b13 Make code path easier for static analyzers
64abb72 nl80211: Allow old r-o-c offchannel TX to be tested
fa72a88 P2P: Fix validation on Invitation Request error path
ca412c7 Remove unreachable return statement
2af4d87 GAS: Fix additional comeback delay with status code 95
07d462c Interworking: Remove unused password setting for SIM credential
3141b82 Add OSEN to proto config field writer
b908c50 Clear hostapd bss entry to NULL on add-interface-failure
0052ce4 atheros: Add support for OSEN
Change-Id: Ifd78a8f8259e5b0f654d3dbadd24c9ab029d3afb
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/ap/dfs.c | 4 | ||||
| -rw-r--r-- | src/ap/drv_callbacks.c | 14 | ||||
| -rw-r--r-- | src/ap/hostapd.c | 10 | ||||
| -rw-r--r-- | src/ap/hw_features.c | 2 | ||||
| -rw-r--r-- | src/ap/ieee802_11.c | 13 | ||||
| -rw-r--r-- | src/ap/ieee802_11_ht.c | 1 | ||||
| -rw-r--r-- | src/ap/peerkey_auth.c | 4 | ||||
| -rw-r--r-- | src/common/ieee802_11_defs.h | 1 | ||||
| -rw-r--r-- | src/common/wpa_common.c | 31 | ||||
| -rw-r--r-- | src/crypto/tls_openssl.c | 8 | ||||
| -rw-r--r-- | src/drivers/driver_atheros.c | 19 | ||||
| -rw-r--r-- | src/drivers/driver_nl80211.c | 11 | ||||
| -rw-r--r-- | src/drivers/driver_roboswitch.c | 20 | ||||
| -rw-r--r-- | src/drivers/driver_test.c | 15 | ||||
| -rw-r--r-- | src/eap_peer/eap_fast.c | 6 | ||||
| -rw-r--r-- | src/p2p/p2p_invitation.c | 15 | ||||
| -rw-r--r-- | src/radius/radius_server.c | 2 | ||||
| -rw-r--r-- | src/utils/trace.c | 1 | ||||
| -rw-r--r-- | src/wps/ndef.c | 6 | ||||
| -rw-r--r-- | src/wps/wps_upnp_web.c | 4 |
20 files changed, 116 insertions, 71 deletions
diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 612f5348..2b8b90fc 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -214,6 +214,7 @@ static void dfs_adjust_vht_center_freq(struct hostapd_iface *iface, break; default: wpa_printf(MSG_INFO, "DFS only VHT20/40/80/160 is supported now"); + *vht_oper_centr_freq_seg0_idx = 0; break; } @@ -359,6 +360,9 @@ dfs_get_valid_channel(struct hostapd_iface *iface, u32 _rand; wpa_printf(MSG_DEBUG, "DFS: Selecting random channel"); + *secondary_channel = 0; + *vht_oper_centr_freq_seg0_idx = 0; + *vht_oper_centr_freq_seg1_idx = 0; if (iface->current_mode == NULL) return NULL; diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 6fb10566..3318f7a5 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -678,6 +678,20 @@ static int hostapd_mgmt_rx(struct hostapd_data *hapd, struct rx_mgmt *rx_mgmt) struct hostapd_frame_info fi; int ret; +#ifdef CONFIG_TESTING_OPTIONS + if (hapd->ext_mgmt_frame_handling) { + size_t hex_len = 2 * rx_mgmt->frame_len + 1; + char *hex = os_malloc(hex_len); + if (hex) { + wpa_snprintf_hex(hex, hex_len, rx_mgmt->frame, + rx_mgmt->frame_len); + wpa_msg(hapd->msg_ctx, MSG_INFO, "MGMT-RX %s", hex); + os_free(hex); + } + return 1; + } +#endif /* CONFIG_TESTING_OPTIONS */ + hdr = (const struct ieee80211_hdr *) rx_mgmt->frame; bssid = get_hdr_bssid(hdr, rx_mgmt->frame_len); if (bssid == NULL) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 75baec0e..ad1c2d03 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1807,6 +1807,7 @@ int hostapd_add_iface(struct hapd_interfaces *interfaces, char *buf) if (start_ctrl_iface_bss(hapd) < 0 || (hapd_iface->state == HAPD_IFACE_ENABLED && hostapd_setup_bss(hapd, -1))) { + hapd_iface->bss[hapd_iface->num_bss - 1] = NULL; hapd_iface->conf->num_bss--; hapd_iface->num_bss--; wpa_printf(MSG_DEBUG, "%s: free hapd %p %s", @@ -1876,14 +1877,17 @@ fail: if (hapd_iface->bss) { for (i = 0; i < hapd_iface->num_bss; i++) { hapd = hapd_iface->bss[i]; - if (hapd && hapd_iface->interfaces && + if (!hapd) + continue; + if (hapd_iface->interfaces && hapd_iface->interfaces->ctrl_iface_deinit) hapd_iface->interfaces-> ctrl_iface_deinit(hapd); wpa_printf(MSG_DEBUG, "%s: free hapd %p (%s)", __func__, hapd_iface->bss[i], - hapd_iface->bss[i]->conf->iface); - os_free(hapd_iface->bss[i]); + hapd->conf->iface); + os_free(hapd); + hapd_iface->bss[i] = NULL; } os_free(hapd_iface->bss); } diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c index 7d36790c..af1bc9bb 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c @@ -982,8 +982,6 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface) hostapd_notify_bad_chans(iface); return -3; } - - return 0; } diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index 3e704e56..c97cef13 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -1738,19 +1738,6 @@ int ieee802_11_mgmt(struct hostapd_data *hapd, const u8 *buf, size_t len, u16 fc, stype; int ret = 0; -#ifdef CONFIG_TESTING_OPTIONS - if (hapd->ext_mgmt_frame_handling) { - size_t hex_len = 2 * len + 1; - char *hex = os_malloc(hex_len); - if (hex) { - wpa_snprintf_hex(hex, hex_len, buf, len); - wpa_msg(hapd->msg_ctx, MSG_INFO, "MGMT-RX %s", hex); - os_free(hex); - } - return 1; - } -#endif /* CONFIG_TESTING_OPTIONS */ - if (len < 24) return 0; diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c index 31dc47ed..a1661783 100644 --- a/src/ap/ieee802_11_ht.c +++ b/src/ap/ieee802_11_ht.c @@ -139,7 +139,6 @@ int hostapd_ht_operation_update(struct hostapd_iface *iface) op_mode_changes++; } - new_op_mode = 0; if (iface->num_sta_no_ht) new_op_mode = OP_MODE_MIXED; else if (iface->conf->secondary_channel && iface->num_sta_ht_20mhz) diff --git a/src/ap/peerkey_auth.c b/src/ap/peerkey_auth.c index ba5c6064..612babc6 100644 --- a/src/ap/peerkey_auth.c +++ b/src/ap/peerkey_auth.c @@ -221,8 +221,8 @@ static void wpa_send_smk_m5(struct wpa_authenticator *wpa_auth, return; /* Peer RSN IE */ - os_memcpy(buf, kde->rsn_ie, kde->rsn_ie_len); - pos = buf + kde->rsn_ie_len; + os_memcpy(pos, kde->rsn_ie, kde->rsn_ie_len); + pos += kde->rsn_ie_len; /* Peer MAC Address */ pos = wpa_add_kde(pos, RSN_KEY_DATA_MAC_ADDR, peer, ETH_ALEN, NULL, 0); diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 520e55d9..cf4664fd 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -161,6 +161,7 @@ #define WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ 76 #define WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED 77 #define WLAN_STATUS_TRANSMISSION_FAILURE 79 +#define WLAN_STATUS_QUERY_RESP_OUTSTANDING 95 #define WLAN_STATUS_ASSOC_DENIED_NO_VHT 104 /* Reason codes (IEEE 802.11-2007, 7.3.1.7, Table 7-22) */ diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c index c9d0ccb7..27f58aa3 100644 --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c @@ -558,8 +558,9 @@ int wpa_parse_wpa_ie_rsn(const u8 *rsn_ie, size_t rsn_ie_len, #endif /* CONFIG_IEEE80211W */ if (left > 0) { - wpa_printf(MSG_DEBUG, "%s: ie has %u trailing bytes - ignored", - __func__, left); + wpa_hexdump(MSG_DEBUG, + "wpa_parse_wpa_ie_rsn: ignore trailing bytes", + pos, left); } return 0; @@ -696,8 +697,9 @@ int wpa_parse_wpa_ie_wpa(const u8 *wpa_ie, size_t wpa_ie_len, } if (left > 0) { - wpa_printf(MSG_DEBUG, "%s: ie has %u trailing bytes - ignored", - __func__, left); + wpa_hexdump(MSG_DEBUG, + "wpa_parse_wpa_ie_wpa: ignore trailing bytes", + pos, left); } return 0; @@ -1195,66 +1197,57 @@ u32 wpa_cipher_to_suite(int proto, int cipher) } -int rsn_cipher_put_suites(u8 *pos, int ciphers) +int rsn_cipher_put_suites(u8 *start, int ciphers) { - int num_suites = 0; + u8 *pos = start; if (ciphers & WPA_CIPHER_CCMP_256) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_CCMP_256); pos += RSN_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_GCMP_256) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_GCMP_256); pos += RSN_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_CCMP) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_CCMP); pos += RSN_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_GCMP) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_GCMP); pos += RSN_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_TKIP) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_TKIP); pos += RSN_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_NONE) { RSN_SELECTOR_PUT(pos, RSN_CIPHER_SUITE_NONE); pos += RSN_SELECTOR_LEN; - num_suites++; } - return num_suites; + return (pos - start) / RSN_SELECTOR_LEN; } -int wpa_cipher_put_suites(u8 *pos, int ciphers) +int wpa_cipher_put_suites(u8 *start, int ciphers) { - int num_suites = 0; + u8 *pos = start; if (ciphers & WPA_CIPHER_CCMP) { RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_CCMP); pos += WPA_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_TKIP) { RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_TKIP); pos += WPA_SELECTOR_LEN; - num_suites++; } if (ciphers & WPA_CIPHER_NONE) { RSN_SELECTOR_PUT(pos, WPA_CIPHER_SUITE_NONE); pos += WPA_SELECTOR_LEN; - num_suites++; } - return num_suites; + return (pos - start) / RSN_SELECTOR_LEN; } diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c index e6068286..d4c6b8b6 100644 --- a/src/crypto/tls_openssl.c +++ b/src/crypto/tls_openssl.c @@ -785,12 +785,13 @@ void * tls_init(const struct tls_config *conf) PKCS12_PBE_add(); #endif /* PKCS12_FUNCS */ } else { - context = tls_global; #ifdef OPENSSL_SUPPORTS_CTX_APP_DATA /* Newer OpenSSL can store app-data per-SSL */ context = tls_context_new(conf); if (context == NULL) return NULL; +#else /* OPENSSL_SUPPORTS_CTX_APP_DATA */ + context = tls_global; #endif /* OPENSSL_SUPPORTS_CTX_APP_DATA */ } tls_openssl_ref_count++; @@ -988,9 +989,10 @@ struct tls_connection * tls_connection_init(void *ssl_ctx) SSL_CTX *ssl = ssl_ctx; struct tls_connection *conn; long options; - struct tls_context *context = tls_global; #ifdef OPENSSL_SUPPORTS_CTX_APP_DATA - context = SSL_CTX_get_app_data(ssl); + struct tls_context *context = SSL_CTX_get_app_data(ssl); +#else /* OPENSSL_SUPPORTS_CTX_APP_DATA */ + struct tls_context *context = tls_global; #endif /* OPENSSL_SUPPORTS_CTX_APP_DATA */ conn = os_zalloc(sizeof(*conn)); diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c index 23a4e2b9..c146cdc5 100644 --- a/src/drivers/driver_atheros.c +++ b/src/drivers/driver_atheros.c @@ -1868,6 +1868,25 @@ static int atheros_set_ap(void *priv, struct wpa_driver_ap_params *params) wpa_hexdump_buf(MSG_DEBUG, "atheros: assocresp_ies", params->assocresp_ies); +#if defined(CONFIG_HS20) && defined(IEEE80211_PARAM_OSEN) + if (params->osen) { + struct wpa_bss_params bss_params; + + os_memset(&bss_params, 0, sizeof(struct wpa_bss_params)); + bss_params.enabled = 1; + bss_params.wpa = 2; + bss_params.wpa_pairwise = WPA_CIPHER_CCMP; + bss_params.wpa_group = WPA_CIPHER_CCMP; + bss_params.ieee802_1x = 1; + + if (atheros_set_privacy(priv, 1) || + set80211param(priv, IEEE80211_PARAM_OSEN, 1)) + return -1; + + return atheros_set_ieee8021x(priv, &bss_params); + } +#endif /* CONFIG_HS20 && IEEE80211_PARAM_OSEN */ + return 0; } diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 42578b61..c5091705 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -301,6 +301,7 @@ struct wpa_driver_nl80211_data { unsigned int hostapd:1; unsigned int start_mode_ap:1; unsigned int start_iface_up:1; + unsigned int test_use_roc_tx:1; u64 remain_on_chan_cookie; u64 send_action_cookie; @@ -9926,7 +9927,8 @@ static int nl80211_send_frame_cmd(struct i802_bss *bss, NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); if (wait) NLA_PUT_U32(msg, NL80211_ATTR_DURATION, wait); - if (offchanok && (drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX)) + if (offchanok && ((drv->capa.flags & WPA_DRIVER_FLAGS_OFFCHANNEL_TX) || + drv->test_use_roc_tx)) NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); if (no_cck) NLA_PUT_FLAG(msg, NL80211_ATTR_TX_NO_CCK_RATE); @@ -10510,6 +10512,13 @@ static int nl80211_set_param(void *priv, const char *param) drv->capa.flags &= ~WPA_DRIVER_FLAGS_SME; } + if (os_strstr(param, "no_offchannel_tx=1")) { + struct i802_bss *bss = priv; + struct wpa_driver_nl80211_data *drv = bss->drv; + drv->capa.flags &= ~WPA_DRIVER_FLAGS_OFFCHANNEL_TX; + drv->test_use_roc_tx = 1; + } + return 0; } diff --git a/src/drivers/driver_roboswitch.c b/src/drivers/driver_roboswitch.c index 0a9078a4..9ce3fa2f 100644 --- a/src/drivers/driver_roboswitch.c +++ b/src/drivers/driver_roboswitch.c @@ -260,17 +260,17 @@ static int wpa_driver_roboswitch_join(struct wpa_driver_roboswitch_data *drv, ROBO_ARLCTRL_CONF, read1, 1); } else { /* if both multiport addresses are the same we can add */ - wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, - ROBO_ARLCTRL_ADDR_1, read1, 3); - wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, - ROBO_ARLCTRL_ADDR_2, read2, 3); - if (os_memcmp(read1, read2, 6) != 0) + if (wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, + ROBO_ARLCTRL_ADDR_1, read1, 3) || + wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, + ROBO_ARLCTRL_ADDR_2, read2, 3) || + os_memcmp(read1, read2, 6) != 0) return -1; - wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, - ROBO_ARLCTRL_VEC_1, read1, 1); - wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, - ROBO_ARLCTRL_VEC_2, read2, 1); - if (read1[0] != read2[0]) + if (wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, + ROBO_ARLCTRL_VEC_1, read1, 1) || + wpa_driver_roboswitch_read(drv, ROBO_ARLCTRL_PAGE, + ROBO_ARLCTRL_VEC_2, read2, 1) || + read1[0] != read2[0]) return -1; wpa_driver_roboswitch_write(drv, ROBO_ARLCTRL_PAGE, ROBO_ARLCTRL_ADDR_1, addr_be16, 3); diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c index 7d306553..1b13d3d2 100644 --- a/src/drivers/driver_test.c +++ b/src/drivers/driver_test.c @@ -1529,7 +1529,8 @@ static int wpa_driver_test_associate( #endif /* DRIVER_TEST_UNIX */ if (params->mode == IEEE80211_MODE_AP) { - os_memcpy(dbss->ssid, params->ssid, params->ssid_len); + if (params->ssid) + os_memcpy(dbss->ssid, params->ssid, params->ssid_len); dbss->ssid_len = params->ssid_len; os_memcpy(dbss->bssid, drv->own_addr, ETH_ALEN); if (params->wpa_ie && params->wpa_ie_len) { @@ -1550,8 +1551,9 @@ static int wpa_driver_test_associate( MAC2STR(drv->own_addr)); if (ret >= 0 && ret < end - pos) pos += ret; - pos += wpa_snprintf_hex(pos, end - pos, params->ssid, - params->ssid_len); + if (params->ssid) + pos += wpa_snprintf_hex(pos, end - pos, params->ssid, + params->ssid_len); ret = os_snprintf(pos, end - pos, " "); if (ret >= 0 && ret < end - pos) pos += ret; @@ -1575,12 +1577,15 @@ static int wpa_driver_test_associate( return -1; } - os_memcpy(dbss->ssid, params->ssid, params->ssid_len); + if (params->ssid) + os_memcpy(dbss->ssid, params->ssid, params->ssid_len); dbss->ssid_len = params->ssid_len; } else { drv->associated = 1; if (params->mode == IEEE80211_MODE_IBSS) { - os_memcpy(dbss->ssid, params->ssid, params->ssid_len); + if (params->ssid) + os_memcpy(dbss->ssid, params->ssid, + params->ssid_len); dbss->ssid_len = params->ssid_len; if (params->bssid) os_memcpy(dbss->bssid, params->bssid, diff --git a/src/eap_peer/eap_fast.c b/src/eap_peer/eap_fast.c index 1b0c562a..cc1f264b 100644 --- a/src/eap_peer/eap_fast.c +++ b/src/eap_peer/eap_fast.c @@ -149,14 +149,16 @@ static void * eap_fast_init(struct eap_sm *sm) struct eap_fast_data *data; struct eap_peer_config *config = eap_get_config(sm); + if (config == NULL) + return NULL; + data = os_zalloc(sizeof(*data)); if (data == NULL) return NULL; data->fast_version = EAP_FAST_VERSION; data->max_pac_list_len = 10; - if (config && config->phase1 && - eap_fast_parse_phase1(data, config->phase1) < 0) { + if (config->phase1 && eap_fast_parse_phase1(data, config->phase1) < 0) { eap_fast_deinit(sm, data); return NULL; } diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c index 30d218cf..a45fe198 100644 --- a/src/p2p/p2p_invitation.c +++ b/src/p2p/p2p_invitation.c @@ -359,12 +359,17 @@ fail: p2p->inv_group_bssid_ptr = p2p->inv_group_bssid; } else p2p->inv_group_bssid_ptr = NULL; - if (msg.group_id_len - ETH_ALEN <= 32) { - os_memcpy(p2p->inv_ssid, msg.group_id + ETH_ALEN, - msg.group_id_len - ETH_ALEN); - p2p->inv_ssid_len = msg.group_id_len - ETH_ALEN; + if (msg.group_id) { + if (msg.group_id_len - ETH_ALEN <= 32) { + os_memcpy(p2p->inv_ssid, msg.group_id + ETH_ALEN, + msg.group_id_len - ETH_ALEN); + p2p->inv_ssid_len = msg.group_id_len - ETH_ALEN; + } + os_memcpy(p2p->inv_go_dev_addr, msg.group_id, ETH_ALEN); + } else { + p2p->inv_ssid_len = 0; + os_memset(p2p->inv_go_dev_addr, 0, ETH_ALEN); } - os_memcpy(p2p->inv_go_dev_addr, msg.group_id, ETH_ALEN); p2p->inv_status = status; p2p->inv_op_freq = op_freq; diff --git a/src/radius/radius_server.c b/src/radius/radius_server.c index 5074b602..6b86932a 100644 --- a/src/radius/radius_server.c +++ b/src/radius/radius_server.c @@ -1371,8 +1371,8 @@ radius_server_read_clients(const char *client_file, int ipv6) break; } entry->shared_secret_len = os_strlen(entry->shared_secret); - entry->addr.s_addr = addr.s_addr; if (!ipv6) { + entry->addr.s_addr = addr.s_addr; val = 0; for (i = 0; i < mask; i++) val |= 1 << (31 - i); diff --git a/src/utils/trace.c b/src/utils/trace.c index 6795d417..94440f2f 100644 --- a/src/utils/trace.c +++ b/src/utils/trace.c @@ -187,6 +187,7 @@ static void wpa_trace_bfd_addr(void *pc) wpa_printf(MSG_INFO, " %s() %s:%u", name, filename, data.line); free(aname); + aname = NULL; data.found = bfd_find_inliner_info(abfd, &data.filename, &data.function, &data.line); diff --git a/src/wps/ndef.c b/src/wps/ndef.c index 2b350647..d45dfc8e 100644 --- a/src/wps/ndef.c +++ b/src/wps/ndef.c @@ -148,7 +148,8 @@ static struct wpabuf * ndef_build_record(u8 flags, void *type, static int wifi_filter(struct ndef_record *record) { - if (record->type_length != os_strlen(wifi_handover_type)) + if (record->type == NULL || + record->type_length != os_strlen(wifi_handover_type)) return 0; if (os_memcmp(record->type, wifi_handover_type, os_strlen(wifi_handover_type)) != 0) @@ -173,7 +174,8 @@ struct wpabuf * ndef_build_wifi(const struct wpabuf *buf) static int p2p_filter(struct ndef_record *record) { - if (record->type_length != os_strlen(p2p_handover_type)) + if (record->type == NULL || + record->type_length != os_strlen(p2p_handover_type)) return 0; if (os_memcmp(record->type, p2p_handover_type, os_strlen(p2p_handover_type)) != 0) diff --git a/src/wps/wps_upnp_web.c b/src/wps/wps_upnp_web.c index 2a3b6360..54c3658a 100644 --- a/src/wps/wps_upnp_web.c +++ b/src/wps/wps_upnp_web.c @@ -946,7 +946,7 @@ static void web_connection_parse_subscribe(struct upnp_wps_device_sm *sm, wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP SUBSCRIBE for event"); end = os_strchr(h, '\n'); - for (; end != NULL; h = end + 1) { + while (end) { /* Option line by option line */ h = end + 1; end = os_strchr(h, '\n'); @@ -1153,7 +1153,7 @@ static void web_connection_parse_unsubscribe(struct upnp_wps_device_sm *sm, wpa_printf(MSG_DEBUG, "WPS UPnP: HTTP UNSUBSCRIBE for event"); end = os_strchr(h, '\n'); - for (; end != NULL; h = end + 1) { + while (end) { /* Option line by option line */ h = end + 1; end = os_strchr(h, '\n'); |
