diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index f5a603588..5563f6cf6 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -523,12 +523,12 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level, msg.wps_sec_dev_type_list_len; } - for (i = 0; i < P2P_MAX_PEER_WPS_VENDOR_EXT; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { wpabuf_free(dev->info.wps_vendor_ext[i]); dev->info.wps_vendor_ext[i] = NULL; } - for (i = 0; i < P2P_MAX_PEER_WPS_VENDOR_EXT; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { if (msg.wps_vendor_ext[i] == NULL) break; dev->info.wps_vendor_ext[i] = wpabuf_alloc_copy( @@ -590,7 +590,7 @@ static void p2p_device_free(struct p2p_data *p2p, struct p2p_device *dev) p2p->cfg->dev_lost(p2p->cfg->cb_ctx, dev->info.p2p_device_addr); - for (i = 0; i < P2P_MAX_PEER_WPS_VENDOR_EXT; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { wpabuf_free(dev->info.wps_vendor_ext[i]); dev->info.wps_vendor_ext[i] = NULL; } @@ -2046,7 +2046,7 @@ void p2p_remove_wps_vendor_extensions(struct p2p_data *p2p) { int i; - for (i = 0; i < P2P_MAX_WPS_VENDOR_EXTENSIONS; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { wpabuf_free(p2p->wps_vendor_ext[i]); p2p->wps_vendor_ext[i] = NULL; } @@ -2061,11 +2061,11 @@ int p2p_add_wps_vendor_extension(struct p2p_data *p2p, if (vendor_ext == NULL) return -1; - for (i = 0; i < P2P_MAX_WPS_VENDOR_EXTENSIONS; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { if (p2p->wps_vendor_ext[i] == NULL) break; } - if (i >= P2P_MAX_WPS_VENDOR_EXTENSIONS) + if (i >= P2P_MAX_WPS_VENDOR_EXT) return -1; p2p->wps_vendor_ext[i] = wpabuf_dup(vendor_ext); diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 40c58e981..3d75965ce 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -138,9 +138,10 @@ enum p2p_scan_type { P2P_SCAN_SOCIAL_PLUS_ONE }; +#define P2P_MAX_WPS_VENDOR_EXT 10 + /** * struct p2p_peer_info - P2P peer information - */ struct p2p_peer_info { /** @@ -186,8 +187,7 @@ struct p2p_peer_info { */ size_t wps_sec_dev_type_list_len; -#define P2P_MAX_PEER_WPS_VENDOR_EXT 10 - struct wpabuf *wps_vendor_ext[P2P_MAX_PEER_WPS_VENDOR_EXT]; + struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; }; /** diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c index 28ad239d5..bd263381b 100644 --- a/src/p2p/p2p_build.c +++ b/src/p2p/p2p_build.c @@ -397,7 +397,7 @@ void p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, u16 pw_id, } /* Add the WPS vendor extensions */ - for (i = 0; i < P2P_MAX_WPS_VENDOR_EXTENSIONS; i++) { + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { if (p2p->wps_vendor_ext[i] == NULL) break; if (wpabuf_tailroom(buf) < diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index 4e12c7023..237abbf06 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -385,11 +385,10 @@ struct p2p_data { int best_freq_5; int best_freq_overall; -#define P2P_MAX_WPS_VENDOR_EXTENSIONS 10 /** * wps_vendor_ext - WPS Vendor Extensions to add */ - struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXTENSIONS]; + struct wpabuf *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; }; /** @@ -445,8 +444,8 @@ struct p2p_message { const u8 *wps_pri_dev_type; const u8 *wps_sec_dev_type_list; size_t wps_sec_dev_type_list_len; - const u8 *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXTENSIONS]; - size_t wps_vendor_ext_len[P2P_MAX_WPS_VENDOR_EXTENSIONS]; + const u8 *wps_vendor_ext[P2P_MAX_WPS_VENDOR_EXT]; + size_t wps_vendor_ext_len[P2P_MAX_WPS_VENDOR_EXT]; /* DS Parameter Set IE */ const u8 *ds_params; diff --git a/src/p2p/p2p_parse.c b/src/p2p/p2p_parse.c index 403162934..8787074c1 100644 --- a/src/p2p/p2p_parse.c +++ b/src/p2p/p2p_parse.c @@ -359,9 +359,7 @@ static int p2p_parse_wps_ie(const struct wpabuf *buf, struct p2p_message *msg) msg->wps_sec_dev_type_list_len = attr.sec_dev_type_list_len; } - for (i = 0; i < P2P_MAX_PEER_WPS_VENDOR_EXT; i++) { - if (i >= P2P_MAX_WPS_VENDOR_EXTENSIONS) - break; + for (i = 0; i < P2P_MAX_WPS_VENDOR_EXT; i++) { msg->wps_vendor_ext[i] = attr.vendor_ext[i]; msg->wps_vendor_ext_len[i] = attr.vendor_ext_len[i]; }