diff options
author | realmadsci <71108352+realmadsci@users.noreply.github.com> | 2021-03-15 13:12:11 -0400 |
---|---|---|
committer | realmadsci <71108352+realmadsci@users.noreply.github.com> | 2021-03-15 12:25:01 -0700 |
commit | 27c048086659808bc1e6742023d4e89330283e02 (patch) | |
tree | 5af91de13cc32b67290cf53bab2fa4a9d0d58436 /src/afl-common.c | |
parent | b289e7ad073d4affae76de3da5d1faeba0f8a07e (diff) | |
download | afl++-27c048086659808bc1e6742023d4e89330283e02.tar.gz |
afl-showmap: Allow @@ to be part of an arg
The previous implementation of "@@ handling" in afl-showmap differed greatly from how it was handled in afl-fuzz and how the documentation presented it. It used to require that the @@ be its own argument separated by whitespace and could not be used in situations like "--file=@@". This change standardizes it to use detect_file_args() like everybody else does, so that it will have the expected and documented behavior.
Diffstat (limited to 'src/afl-common.c')
-rw-r--r-- | src/afl-common.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/afl-common.c b/src/afl-common.c index 9f6eb564..55564554 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -70,31 +70,26 @@ void detect_file_args(char **argv, u8 *prog_in, bool *use_stdin) { *use_stdin = false; - if (prog_in[0] != 0) { // not afl-showmap special case + /* Be sure that we're always using fully-qualified paths. */ - u8 *n_arg; + *aa_loc = 0; - /* Be sure that we're always using fully-qualified paths. */ + /* Construct a replacement argv value. */ + u8 *n_arg; - *aa_loc = 0; + if (prog_in[0] == '/') { - /* Construct a replacement argv value. */ + n_arg = alloc_printf("%s%s%s", argv[i], prog_in, aa_loc + 2); - if (prog_in[0] == '/') { - - n_arg = alloc_printf("%s%s%s", argv[i], prog_in, aa_loc + 2); - - } else { - - n_arg = alloc_printf("%s%s/%s%s", argv[i], cwd, prog_in, aa_loc + 2); - - } + } else { - ck_free(argv[i]); - argv[i] = n_arg; + n_arg = alloc_printf("%s%s/%s%s", argv[i], cwd, prog_in, aa_loc + 2); } + ck_free(argv[i]); + argv[i] = n_arg; + } i++; |