cybersecurity · intermediate · ~15 min · safe pentest lab

Read stays within input?

Validate every slice against the fuzz input.

Challenge

Implement int read_within(int offset, int len, int size) returning 1 if reading len bytes at offset stays inside size (offset >= 0, len >= 0, offset + len <= size), else 0.

Starter code

int read_within(int offset, int len, int size) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.