aboutsummaryrefslogtreecommitdiff
path: root/gcc_plugin
diff options
context:
space:
mode:
authorRick van Schijndel <rol3517@gmail.com>2020-04-23 23:16:13 +0200
committerRick van Schijndel <rol3517@gmail.com>2020-04-23 23:21:38 +0200
commit82b6b8c87e1bc5394349fd2931b306f671c4da1a (patch)
treee412a9c3aa0b952402d38d1487d22fdb3f1e69eb /gcc_plugin
parentb6f9f4c436bc8c63f9039847d2a7b6e13da3515e (diff)
downloadafl++-82b6b8c87e1bc5394349fd2931b306f671c4da1a.tar.gz
afl-gcc and afl-clang: fail when binary name can't be used to determine build mode
This is a continuation of PR #318. The goal is to prevent issues where binaries with the wrong name will silently pass control to the C compiler instead of failing. This makes it more explicit that aflplusplus relies on the name of the binary for correct compiler execution.
Diffstat (limited to 'gcc_plugin')
-rw-r--r--gcc_plugin/afl-gcc-fast.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc_plugin/afl-gcc-fast.c b/gcc_plugin/afl-gcc-fast.c
index 0e51ee62..164c72c2 100644
--- a/gcc_plugin/afl-gcc-fast.c
+++ b/gcc_plugin/afl-gcc-fast.c
@@ -123,11 +123,17 @@ static void edit_params(u32 argc, char **argv) {
u8 *alt_cxx = getenv("AFL_CXX");
cc_params[0] = alt_cxx && *alt_cxx ? alt_cxx : (u8 *)AFL_GCC_CXX;
- } else {
+ } else if (!strcmp(name, "afl-gcc-fast")) {
u8 *alt_cc = getenv("AFL_CC");
cc_params[0] = alt_cc && *alt_cc ? alt_cc : (u8 *)AFL_GCC_CC;
+ } else {
+
+ fprintf(stderr, "Name of the binary: %s\n", argv[0]);
+ FATAL(
+ "Name of the binary is not a known name, expected afl-(gcc|g++)-fast");
+
}
char *fplugin_arg = alloc_printf("-fplugin=%s/afl-gcc-pass.so", obj_path);