diff options
author | Alexander Shvedov <60114847+a-shvedov@users.noreply.github.com> | 2024-05-30 10:43:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 10:43:01 +0300 |
commit | f8a5f1cd9ea907654f42fa06ce6b6bfd4b8c1b13 (patch) | |
tree | 7aec2a095a30ed609ce96f85ec3c4e0a8b8eb74c /test-instr.c | |
parent | 629edb1e78d791894ce9ee6d53259f95fe1a29af (diff) | |
parent | e7d871c8bf64962a658e447b90a1a3b43aaddc28 (diff) | |
download | afl++-f8a5f1cd9ea907654f42fa06ce6b6bfd4b8c1b13.tar.gz |
Merge branch 'AFLplusplus:stable' into stable
Diffstat (limited to 'test-instr.c')
-rw-r--r-- | test-instr.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test-instr.c b/test-instr.c index 1d9f2e6e..28552893 100644 --- a/test-instr.c +++ b/test-instr.c @@ -3,7 +3,7 @@ -------------------------------------------------------- Originally written by Michal Zalewski Copyright 2014 Google Inc. All rights reserved. - Copyright 2019-2023 AFLplusplus Project. All rights reserved. + Copyright 2019-2024 AFLplusplus Project. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: @@ -24,7 +24,7 @@ int main(int argc, char **argv) { - int fd = 0; + int fd = 0, cnt; char buff[8]; char *buf = buff; @@ -32,7 +32,6 @@ int main(int argc, char **argv) { if (argc == 2) { buf = argv[1]; - printf("Input %s - ", buf); } else { @@ -47,15 +46,19 @@ int main(int argc, char **argv) { } - if (read(fd, buf, sizeof(buf)) < 1) { + if ((cnt = read(fd, buf, sizeof(buf) - 1)) < 1) { printf("Hum?\n"); return 1; } + buf[cnt] = 0; + } + if (getenv("AFL_DEBUG")) fprintf(stderr, "test-instr: %s\n", buf); + // we support three input cases (plus a 4th if stdin is used but there is no // input) switch (buf[0]) { |