cybersecurity · beginner · ~15 min · safe pentest lab
Bail out on short fuzz input.
Write the guard a fuzz target uses first: is there enough input to read a fixed-size header?
Implement int size_guard(int size, int header_size) that returns 1 if size >= header_size, else 0.
size: the length of the fuzzer-supplied input.header_size: the number of bytes the parser needs up front.Returns int: 1 if there is enough input (size >= header_size), else 0.
size_guard(10, 8) -> 1
size_guard(8, 8) -> 1 (exactly enough)
size_guard(4, 8) -> 0 (too short)
size exactly equal to header_size is enough (return 1).Two ints: the input size and the required header_size.
An int: 1 if size >= header_size, else 0.
size == header_size counts as enough.
int size_guard(int size, int header_size) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.