cybersecurity · intermediate · ~15 min · safe pentest lab

Count unsafe calls

Tally several dangerous patterns.

Challenge

Implement int count_unsafe(const char *code) returning how many occurrences of the unsafe calls "strcpy(", "strcat(", "sprintf(", and "gets(" appear (summed).

Starter code

#include <string.h>

int count_unsafe(const char *code) {
    /* TODO */
    return 0;
}

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