Remove the element_id member, and, instead of copying over the entire IE
header, just set the length to the value we've already fetched.
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
struct ssid_t {
#define CAPABILITY_PRIVACY(cap) ((cap) & 0x0010)
struct ssid_t {
uint8_t length;
u_char ssid[33]; /* 32 + 1 for null */
};
struct rates_t {
uint8_t length;
u_char ssid[33]; /* 32 + 1 for null */
};
struct rates_t {
uint8_t length;
uint8_t rate[16];
};
struct challenge_t {
uint8_t length;
uint8_t rate[16];
};
struct challenge_t {
uint8_t length;
uint8_t text[254]; /* 1-253 + 1 for null */
};
struct fh_t {
uint8_t length;
uint8_t text[254]; /* 1-253 + 1 for null */
};
struct fh_t {
uint8_t length;
uint16_t dwell_time;
uint8_t hop_set;
uint8_t length;
uint16_t dwell_time;
uint8_t hop_set;
uint8_t length;
uint8_t channel;
};
struct cf_t {
uint8_t length;
uint8_t channel;
};
struct cf_t {
uint8_t length;
uint8_t count;
uint8_t period;
uint8_t length;
uint8_t count;
uint8_t period;
uint8_t length;
uint8_t count;
uint8_t period;
uint8_t length;
uint8_t count;
uint8_t period;
switch (GET_U_1(p + offset)) {
case E_SSID:
switch (GET_U_1(p + offset)) {
case E_SSID:
- memcpy(&ssid, p + offset, 2);
+ ssid.length = elementlen;
offset += 2;
length -= 2;
if (ssid.length != 0) {
offset += 2;
length -= 2;
if (ssid.length != 0) {
}
break;
case E_CHALLENGE:
}
break;
case E_CHALLENGE:
- memcpy(&challenge, p + offset, 2);
+ challenge.length = elementlen;
offset += 2;
length -= 2;
if (challenge.length != 0) {
offset += 2;
length -= 2;
if (challenge.length != 0) {
- memcpy(&rates, p + offset, 2);
+ rates.length = elementlen;
offset += 2;
length -= 2;
if (rates.length != 0) {
offset += 2;
length -= 2;
if (rates.length != 0) {
- memcpy(&ds, p + offset, 2);
+ ds.length = elementlen;
offset += 2;
length -= 2;
if (ds.length != 1) {
offset += 2;
length -= 2;
if (ds.length != 1) {
- memcpy(&cf, p + offset, 2);
+ cf.length = elementlen;
offset += 2;
length -= 2;
if (cf.length != 6) {
offset += 2;
length -= 2;
if (cf.length != 6) {
- memcpy(&tim, p + offset, 2);
+ tim.length = elementlen;
offset += 2;
length -= 2;
if (tim.length <= 3U) {
offset += 2;
length -= 2;
if (tim.length <= 3U) {