no more (?) statics

This commit is contained in:
Dominik Maier
2020-03-19 22:54:09 +01:00
parent 0fa47bb867
commit 5b9d306cdf
10 changed files with 209 additions and 160 deletions

View File

@ -55,6 +55,8 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
u8 * lptr;
u32 cur_line = 0;
u8 int_bufs[2][16];
f = fopen(fname, "r");
if (!f) PFATAL("Unable to open '%s'", fname);
@ -170,8 +172,9 @@ void load_extras_file(afl_state_t *afl, u8 *fname, u32 *min_len, u32 *max_len,
afl->extras[afl->extras_cnt].len = klen;
if (afl->extras[afl->extras_cnt].len > MAX_DICT_FILE)
FATAL("Keyword too big in line %u (%s, limit is %s)", cur_line, DMS(klen),
DMS(MAX_DICT_FILE));
FATAL("Keyword too big in line %u (%s, limit is %s)", cur_line,
DMS(int_bufs[0], sizeof(int_bufs[0]), klen),
DMS(int_bufs[1], sizeof(int_bufs[1]), MAX_DICT_FILE));
if (*min_len > klen) *min_len = klen;
if (*max_len < klen) *max_len = klen;
@ -193,6 +196,8 @@ void load_extras(afl_state_t *afl, u8 *dir) {
u32 min_len = MAX_DICT_FILE, max_len = 0, dict_level = 0;
u8 * x;
u8 int_bufs[2][16];
/* If the name ends with @, extract level and continue. */
if ((x = strchr(dir, '@'))) {
@ -238,8 +243,9 @@ void load_extras(afl_state_t *afl, u8 *dir) {
}
if (st.st_size > MAX_DICT_FILE)
FATAL("Extra '%s' is too big (%s, limit is %s)", fn, DMS(st.st_size),
DMS(MAX_DICT_FILE));
FATAL("Extra '%s' is too big (%s, limit is %s)", fn,
DMS(int_bufs[0], sizeof(int_bufs[0]), st.st_size),
DMS(int_bufs[1], sizeof(int_bufs[1]), MAX_DICT_FILE));
if (min_len > st.st_size) min_len = st.st_size;
if (max_len < st.st_size) max_len = st.st_size;
@ -273,11 +279,12 @@ check_and_sort:
compare_extras_len);
OKF("Loaded %u extra tokens, size range %s to %s.", afl->extras_cnt,
DMS(min_len), DMS(max_len));
DMS(int_bufs[0], sizeof(int_bufs[0]), min_len),
DMS(int_bufs[1], sizeof(int_bufs[1]), max_len));
if (max_len > 32)
WARNF("Some tokens are relatively large (%s) - consider trimming.",
DMS(max_len));
DMS(int_bufs[0], sizeof(int_bufs[0]), max_len));
if (afl->extras_cnt > MAX_DET_EXTRAS)
WARNF("More than %d tokens - will use them probabilistically.",