diff options
author | hexcoder- <heiko@hexco.de> | 2020-03-13 10:06:02 +0100 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2020-03-13 10:06:02 +0100 |
commit | d2787519e33b339f4f2b03bdba32719a60a663a3 (patch) | |
tree | 202de98a39cb3448298d08e7b8e3b62838f785f0 /src | |
parent | 23d0cea3c9e0306aed727798c87b4a392705c98c (diff) | |
download | afl++-d2787519e33b339f4f2b03bdba32719a60a663a3.tar.gz |
afl-common.c: ... but that breaks unicorn_mode, which it should not.
Diffstat (limited to 'src')
-rw-r--r-- | src/afl-common.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/afl-common.c b/src/afl-common.c index 66afcd18..c2a4c476 100644 --- a/src/afl-common.c +++ b/src/afl-common.c @@ -57,36 +57,26 @@ void detect_file_args(char **argv, u8 *prog_in, u8 *use_stdin) { if (aa_loc) { - u8 *n_arg; - if (!prog_in) FATAL("@@ syntax is not supported by this tool."); *use_stdin = 0; if (prog_in[0] != 0) { // not afl-showmap special case - s32 new_size; + u8 *n_arg; /* Be sure that we're always using fully-qualified paths. */ *aa_loc = 0; - if (prog_in[0] == '/') { - new_size = snprintf(NULL, 0, "%s%s%s", argv[i], prog_in, aa_loc + 2); - } else { - new_size = snprintf(NULL, 0, "%s%s/%s%s", argv[i], cwd, prog_in, aa_loc + 2); - } - if (new_size < 0) PFATAL("snprintf() failed"); /* Construct a replacement argv value. */ - if ((n_arg = realloc(argv[i], new_size + 1)) == NULL) { - PFATAL("realloc() failed"); - } if (prog_in[0] == '/') { - snprintf(n_arg, new_size, "%s%s%s", argv[i], prog_in, aa_loc + 2); + n_arg = alloc_printf("%s%s%s", argv[i], prog_in, aa_loc + 2); } else { - snprintf(n_arg, new_size, "%s%s/%s%s", argv[i], cwd, prog_in, aa_loc + 2); + n_arg = alloc_printf("%s%s/%s%s", argv[i], cwd, prog_in, aa_loc + 2); } + free(argv[i]); argv[i] = n_arg; } |