DragonFlyBSD Kernel Audit
DF-0608 / build.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0608 build: nothing to compile for the trigger (source-level finding).
# The verification helper compiles a tiny userspace size-proof inline.
set -e
cd "$(dirname "$0")"
# Compile the inline size-proof binary used by verify_typo.sh step 5.
cc -o /tmp/df0608_sizes -x c - <<'EOF'
#include <stdio.h>
#include <stdint.h>
struct in_addr { uint32_t s_addr; };
struct ng_cisco_ipaddr { struct in_addr ipaddr; struct in_addr netmask; };
int main(void) {
    struct ng_cisco_ipaddr *ips = NULL;
    printf("sizeof(struct ng_cisco_ipaddr) = %zu\n", sizeof(struct ng_cisco_ipaddr));
    printf("sizeof(*ips)                    = %zu\n", sizeof(*ips));
    printf("sizeof(ips)  [pointer, BUGGY]   = %zu\n", sizeof(ips));
    return 0;
}
EOF
echo "BUILD_OK: /tmp/df0608_sizes (size-proof helper)"