cybersecurity · beginner · ~15 min · safe pentest lab

Safer alternative to system()?

Prefer exec-family over the shell.

Challenge

Implement int is_safer_exec(const char *fn) returning 1 for "execv" and "execve" (no shell) and 0 for "system" and "popen".

Starter code

#include <string.h>

int is_safer_exec(const char *fn) {
    /* TODO */
    return 0;
}

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