Commit e27625e1 authored by Bruno Randolf's avatar Bruno Randolf

Frame type 3 is not defined, protect array index

Frame type 3 is possible in the bitmask but not defined in the standard.
Protect the arrays which use frame type by avoiding index of 3.
parent c8ed6911
......@@ -264,8 +264,9 @@ filter_packet(struct packet_info* p)
if (p->phy_flags & PHY_FLAG_BADFCS)
return 0;
/* filter by WLAN frame type */
if (!(conf.filter_stype[WLAN_FRAME_TYPE(p->wlan_type)] & (1 << WLAN_FRAME_STYPE(p->wlan_type)))) {
/* filter by WLAN frame type and also type 3 which is not defined */
i = WLAN_FRAME_TYPE(p->wlan_type);
if (i == 3 || !(conf.filter_stype[i] & (1 << WLAN_FRAME_STYPE(p->wlan_type)))) {
stats.filtered_packets++;
return 1;
}
......
......@@ -83,10 +83,13 @@ static struct pkt_name badfcs = { '*', "BADFCS", 0, "Bad FCS" };
struct pkt_name
get_packet_struct(u_int16_t type) {
int t = WLAN_FRAME_TYPE(type);
if (type == 1) /* special case for bad FCS */
return badfcs;
if (stype_names[WLAN_FRAME_TYPE(type)][WLAN_FRAME_STYPE(type)].c)
if (t == 3)
return unknow;
else
return stype_names[WLAN_FRAME_TYPE(type)][WLAN_FRAME_STYPE(type)];
return unknow;
......
......@@ -21,9 +21,9 @@
#define _WLAN_UTIL_H_
struct pkt_name {
char c;
const char c;
const char* name;
u_int16_t fc;
const u_int16_t fc;
const char* desc;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment