cybersecurity · beginner · ~15 min
Check minimum input length before parsing.
Write the length guard a fuzz target uses before reading a fixed-size header.
Implement int enough_input(int size, int needed) that returns 1 if size >= needed, else 0.
size: the length of the fuzzer-supplied input.needed: the minimum number of bytes the parser requires.Returns int: 1 if size >= needed, else 0.
enough_input(10, 8) -> 1
enough_input(8, 8) -> 1 (exactly enough)
enough_input(4, 8) -> 0 (too short)
size exactly equal to needed is enough (return 1).Two ints: the input size and the required needed.
An int: 1 if size >= needed, else 0.
size == needed counts as enough.
int enough_input(int size, int needed) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.