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.
This commit is contained in:
realmadsci
2021-03-15 13:12:11 -04:00
parent b289e7ad07
commit 27c0480866
2 changed files with 33 additions and 48 deletions

View File

@ -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] == '/') {
} else {
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);
}
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++;