DragonFlyBSD Kernel Audit
DF-0410 / build.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0410 build — compiles the harness in BOTH the vulnerable and fixed forms.
# The vulnerable build transcribes ng_encode_string() VERBATIM from
# sys/netgraph7/netgraph/ng_parse.c:1825-1877 (alloc by strlen, loop by slen).
# The fixed build (-DAPPLY_FIX) uses slen for the allocation (the proposed fix).
set -e
cd "$(dirname "$0")"
echo "=== building VULNERABLE harness ==="
cc -O2 -Wall -o df0410_vuln df0410_harness.c
echo "df0410_vuln built (rc=$?)"
echo "=== building FIXED harness (-DAPPLY_FIX) ==="
cc -O2 -Wall -DAPPLY_FIX -o df0410_fixed df0410_harness.c
echo "df0410_fixed built (rc=$?)"
ls -l df0410_vuln df0410_fixed