mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-10 09:11:34 +00:00
fix persistent demo
This commit is contained in:
parent
63677bb1f9
commit
272a43be11
@ -33,6 +33,7 @@
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
ssize_t len; /* how much input did we read? */
|
||||
char buf[100]; /* Example-only buffer, you'd replace it with other global or
|
||||
local variables appropriate for your use case. */
|
||||
|
||||
@ -57,11 +58,15 @@ int main(int argc, char** argv) {
|
||||
Beware of reading from buffered FILE* objects such as stdin. Use
|
||||
raw file descriptors or call fopen() / fdopen() in every pass. */
|
||||
|
||||
read(0, buf, 100);
|
||||
len = read(0, buf, 100);
|
||||
|
||||
/* STEP 3: This is where we'd call the tested library on the read data.
|
||||
We just have some trivial inline code that faults on 'foo!'. */
|
||||
|
||||
/* do we have enough data? */
|
||||
if (len < 4)
|
||||
return 0;
|
||||
|
||||
if (buf[0] == 'f') {
|
||||
printf("one\n");
|
||||
if (buf[1] == 'o') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user