Exploit databaseDownload repository ZIP
GH-d879f8fbd49e794749f87fba32e9a2ac
helica-core/eap_pwn
Sources for CVE-2023-52160
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files63
helica-core/eap_pwnRevision f17536590df8
- ↑..Parent directory
- Makefile
- base64.c
- base64.h
- bitfield.c
- bitfield.h
- browser-android.c
- browser-system.c
- browser-wpadebug.c
- browser.c
- browser.h
- build_config.h
- common.c
- common.h
- config.c
- config.h
- const_time.h
- crc32.c
- crc32.h
- edit.c
- edit.h
- edit_readline.c
- edit_simple.c
- eloop.c
- eloop.h
- eloop_win.c
- ext_password.c
- ext_password.h
- ext_password_file.c
- ext_password_i.h
- ext_password_test.c
- http-utils.h
- http_curl.c
- includes.h
- ip_addr.c
- ip_addr.h
- json.c
- json.h
- list.h
- module_tests.h
- os.h
- os_internal.c
- os_none.c
- os_unix.c
- os_win32.c
- pcsc_funcs.c
- pcsc_funcs.h
- platform.h
- radiotap.c
- radiotap.h
- radiotap_iter.h
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/utils/bitfield.c
C · 1,404 bytes/*
* Bitfield
* Copyright (c) 2013, Jouni Malinen <[email protected]>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#include "includes.h"
#include "common.h"
#include "bitfield.h"
struct bitfield {
u8 *bits;
size_t max_bits;
};
struct bitfield * bitfield_alloc(size_t max_bits)
{
struct bitfield *bf;
bf = os_zalloc(sizeof(*bf) + (max_bits + 7) / 8);
if (bf == NULL)
return NULL;
bf->bits = (u8 *) (bf + 1);
bf->max_bits = max_bits;
return bf;
}
void bitfield_free(struct bitfield *bf)
{
os_free(bf);
}
void bitfield_set(struct bitfield *bf, size_t bit)
{
if (bit >= bf->max_bits)
return;
bf->bits[bit / 8] |= BIT(bit % 8);
}
void bitfield_clear(struct bitfield *bf, size_t bit)
{
if (bit >= bf->max_bits)
return;
bf->bits[bit / 8] &= ~BIT(bit % 8);
}
int bitfield_is_set(struct bitfield *bf, size_t bit)
{
if (bit >= bf->max_bits)
return 0;
return !!(bf->bits[bit / 8] & BIT(bit % 8));
}
static int first_zero(u8 val)
{
int i;
for (i = 0; i < 8; i++) {
if (!(val & 0x01))
return i;
val >>= 1;
}
return -1;
}
int bitfield_get_first_zero(struct bitfield *bf)
{
size_t i;
for (i = 0; i < (bf->max_bits + 7) / 8; i++) {
if (bf->bits[i] != 0xff)
break;
}
if (i == (bf->max_bits + 7) / 8)
return -1;
i = i * 8 + first_zero(bf->bits[i]);
if (i >= bf->max_bits)
return -1;
return i;
}