Skip to content

Commit

Permalink
2.45b
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-huet committed Jul 29, 2017
1 parent a1d2c39 commit 2cf1924
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 7 deletions.
6 changes: 3 additions & 3 deletions afl-fuzz.c
Expand Up @@ -3310,10 +3310,10 @@ static u32 find_start_position(void) {
i = read(fd, tmp, sizeof(tmp) - 1); (void)i; /* Ignore errors */
close(fd);

off = strstr(tmp, "cur_path : ");
off = strstr(tmp, "cur_path : ");
if (!off) return 0;

ret = atoi(off + 17);
ret = atoi(off + 20);
if (ret >= queued_paths) ret = 0;
return ret;

Expand Down Expand Up @@ -3401,7 +3401,7 @@ static void write_stats_file(double bitmap_cvg, double stability, double eps) {
"paths_found : %u\n"
"paths_imported : %u\n"
"max_depth : %u\n"
"cur_path : %u\n"
"cur_path : %u\n" /* Must match find_start_position() */
"pending_favs : %u\n"
"pending_total : %u\n"
"variable_paths : %u\n"
Expand Down
2 changes: 2 additions & 0 deletions afl-gcc.c
Expand Up @@ -287,6 +287,8 @@ static void edit_params(u32 argc, char** argv) {
cc_params[cc_par_cnt++] = "-fno-builtin-strcasecmp";
cc_params[cc_par_cnt++] = "-fno-builtin-strncasecmp";
cc_params[cc_par_cnt++] = "-fno-builtin-memcmp";
cc_params[cc_par_cnt++] = "-fno-builtin-strstr";
cc_params[cc_par_cnt++] = "-fno-builtin-strcasestr";

}

Expand Down
2 changes: 1 addition & 1 deletion afl-showmap.c
Expand Up @@ -286,7 +286,7 @@ static void run_target(char** argv) {

}

if (keep_cores) r.rlim_max = r.rlim_cur = 0;
if (!keep_cores) r.rlim_max = r.rlim_cur = 0;
else r.rlim_max = r.rlim_cur = RLIM_INFINITY;

setrlimit(RLIMIT_CORE, &r); /* Ignore errors */
Expand Down
2 changes: 1 addition & 1 deletion config.h
Expand Up @@ -21,7 +21,7 @@

/* Version string: */

#define VERSION "2.44b"
#define VERSION "2.45b"

/******************************************************
* *
Expand Down
11 changes: 11 additions & 0 deletions docs/ChangeLog
Expand Up @@ -16,6 +16,17 @@ Not sure if you should upgrade? The lowest currently recommended version
is 2.41b. If you're stuck on an earlier release, it's strongly advisable
to get on with the times.

--------------
Version 2.45b:
--------------

- Added strstr, strcasestr support to libtokencap. Contributed by
Daniel Hodson.

- Fixed a resumption offset glitch spotted by Jakub Wilk.

- There are definitely no bugs in afl-showmap -c now.

--------------
Version 2.44b:
--------------
Expand Down
2 changes: 1 addition & 1 deletion docs/README
Expand Up @@ -482,7 +482,7 @@ bug reports, or patches from:
Joshua J. Drake Toby Hutton
Rene Freingruber Sergey Davidoff
Sami Liedes Craig Young
Andrzej Jackowski
Andrzej Jackowski Daniel Hodson

Thank you!

Expand Down
3 changes: 2 additions & 1 deletion libtokencap/README.tokencap
Expand Up @@ -32,7 +32,8 @@ part without mucking with CFLAGS in Makefiles, you can set AFL_NO_BUILTIN=1
when using afl-gcc. This setting specifically adds the following flags:

-fno-builtin-strcmp -fno-builtin-strncmp -fno-builtin-strcasecmp
-fno-builtin-strcasencmp -fno-builtin-memcmp
-fno-builtin-strcasencmp -fno-builtin-memcmp -fno-builtin-strstr
-fno-builtin-strcasestr

The next step is simply loading this library via LD_PRELOAD. The optimal usage
pattern is to allow afl-fuzz to fuzz normally for a while and build up a corpus,
Expand Down
51 changes: 51 additions & 0 deletions libtokencap/libtokencap.so.c
Expand Up @@ -241,6 +241,57 @@ int memcmp(const void* mem1, const void* mem2, size_t len) {
}


#undef strstr

const char* strstr(const char* haystack, const char* needle) {

if (__tokencap_is_ro(haystack))
__tokencap_dump(haystack, strlen(haystack), 1);

if (__tokencap_is_ro(needle))
__tokencap_dump(needle, strlen(needle), 1);

do {
const char* n = needle;
const char* h = haystack;

while(*n && *h && *n == *h) n++, h++;

if(!*n) return haystack;

} while (*(haystack++));

return 0;

}


#undef strcasestr

const char* strcasestr(const char* haystack, const char* needle) {

if (__tokencap_is_ro(haystack))
__tokencap_dump(haystack, strlen(haystack), 1);

if (__tokencap_is_ro(needle))
__tokencap_dump(needle, strlen(needle), 1);

do {

const char* n = needle;
const char* h = haystack;

while(*n && *h && tolower(*n) == tolower(*h)) n++, h++;

if(!*n) return haystack;

} while(*(haystack++));

return 0;

}


/* Init code to open the output file (or default to stderr). */

__attribute__((constructor)) void __tokencap_init(void) {
Expand Down

0 comments on commit 2cf1924

Please sign in to comment.