Example #1
0
void Dot11::parse_tagged_parameters(InputMemoryStream& stream) {
    if (stream) {
        while (stream.size() >= 2) {
            OptionTypes opcode = static_cast<OptionTypes>(stream.read<uint8_t>());
            uint8_t length = stream.read<uint8_t>();
            if (!stream.can_read(length)) {
                throw malformed_packet();
            }
            add_tagged_option(opcode, length, stream.pointer());
            stream.skip(length);
        }
    }
}
Example #2
0
void Dot11::parse_tagged_parameters(const uint8_t *buffer, uint32_t total_sz) {
    if(total_sz > 0) {
        uint8_t opcode, length;
        while(total_sz >= 2) {
            opcode = buffer[0];
            length = buffer[1];
            buffer += 2;
            total_sz -= 2;
            if(length > total_sz) {
                throw malformed_packet();
            }
            add_tagged_option((OptionTypes)opcode, length, buffer);
            buffer += length;
            total_sz -= length;
        }
    }
}