cybersecurity · intermediate · ~15 min · safe pentest lab
Format a Markdown finding for a report.
Format one finding as a Markdown block so a report stays skimmable and tool-parseable.
Implement int build_finding(char *out, int outsz, const char *title, const char *sev) that writes the finding into out and returns its length.
out: caller buffer of size outsz.title: the finding title.sev: the severity label.Writes exactly ## <title>\n**Severity:** <sev>\n into out (using snprintf) and returns the length snprintf reports.
build_finding(b, 128, "SQL Injection", "High")
-> b = "## SQL Injection\n**Severity:** High\n"
##, the bold **Severity:**, and the trailing newline.An output buffer out, its size outsz, a title, and a severity sev.
The length written by snprintf; out holds ## <title>\n**Severity:** <sev>\n.
Use snprintf; match the exact heading/bold/newline layout.
#include <stdio.h>
int build_finding(char *out, int outsz, const char *title, const char *sev) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.