mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
065e6e7010
This is a newer version of tests/wnm-fuzzer tool as the initial step in creating a more uniform set of fuzzing tools that can be used with both libFuzzer and afl-fuzz. Signed-off-by: Jouni Malinen <j@w1.fi>
57 lines
964 B
C
57 lines
964 B
C
/*
|
|
* Common helper functions for fuzzing tools
|
|
* Copyright (c) 2019, Jouni Malinen <j@w1.fi>
|
|
*
|
|
* This software may be distributed under the terms of the BSD license.
|
|
* See README for more details.
|
|
*/
|
|
|
|
#include "utils/includes.h"
|
|
|
|
#include "utils/common.h"
|
|
|
|
|
|
void wpa_fuzzer_set_debug_level(void)
|
|
{
|
|
static int first = 1;
|
|
|
|
if (first) {
|
|
char *env;
|
|
|
|
first = 0;
|
|
env = getenv("WPADEBUG");
|
|
if (env)
|
|
wpa_debug_level = atoi(env);
|
|
else
|
|
wpa_debug_level = MSG_ERROR + 1;
|
|
|
|
wpa_debug_show_keys = 1;
|
|
}
|
|
}
|
|
|
|
|
|
#ifndef TEST_LIBFUZZER
|
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
char *data;
|
|
size_t len;
|
|
|
|
if (argc < 2) {
|
|
printf("usage: %s <file>\n", argv[0]);
|
|
return -1;
|
|
}
|
|
|
|
data = os_readfile(argv[1], &len);
|
|
if (!data) {
|
|
printf("Could not read '%s'\n", argv[1]);
|
|
return -1;
|
|
}
|
|
|
|
LLVMFuzzerTestOneInput((const uint8_t *) data, len);
|
|
os_free(data);
|
|
return 0;
|
|
}
|
|
#endif /* !TEST_LIBFUZZER */
|