cybersecurity · beginner · ~15 min · safe pentest lab
Enforce the scope list before acting.
Enforce the engagement scope: confirm a target exactly matches the one authorised address before any action — anything outside scope is off-limits.
Implement int in_scope(const char *target, const char *allowed) that returns 1 if target exactly matches the single allowed target string, and 0 otherwise.
target: the address you are about to act on.allowed: the single authorised target.Both are NUL-terminated strings the grader provides.
Returns 1 if the two strings are exactly equal, 0 otherwise.
in_scope("10.0.0.5", "10.0.0.5") -> 1
in_scope("10.0.0.6", "10.0.0.5") -> 0
A target string and the single allowed target string.
1 if target exactly equals allowed; otherwise 0.
Exact string match; anything outside scope is off-limits.
#include <string.h>
int in_scope(const char *target, const char *allowed) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.