networking · beginner · ~15 min
Enforce the authorized-scope rule in code.
Implement int safe_test_target(const char *host) returning 1 only if host is a localhost address ("localhost", "127.0.0.1", "::1"); any other host returns 0 (out of scope without authorization).
#include <string.h>
int safe_test_target(const char *host) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.