cybersecurity · intermediate · ~15 min
Spot characters that break out of a shell command.
Implement int has_shell_meta(const char *s) returning 1 if s contains any of these shell metacharacters: ; | & $ ` ( ) < > newline, else 0.
#include <string.h>
int has_shell_meta(const char *s) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.