Skip to content

fix: defensive hardening across C backend - #311

Open
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/c-backend-hardening
Open

fix: defensive hardening across C backend#311
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/c-backend-hardening

Conversation

@zagers

@zagers zagers commented Jul 19, 2026

Copy link
Copy Markdown

Summary

Grouped low-severity defensive fixes across the C backend for security hardening.

Changes

  • net_io.c: generateReceiverJson — replace sprintf with safe_snprintf for bounds checking
  • net_io.c: Beast escape scan — add sanity limit on eom growth to prevent excessive expansion
  • view1090.c: Check strdup return value for OOM
  • demod_2400.c: Replace assert with runtime check for signal power buffer overlap (asserts are compiled out with NDEBUG)

Deferred

Some issues from the review were deferred as they are design decisions or already safe in practice:

  • Unbounded buffer growth in JSON generation (controlled by aircraft count)
  • Buffer-full discard behavior (intentional design)
  • strlen on hex input (caller NUL-terminates)
  • TOCTOU on json file write (mkstemp already used correctly)

Fixes #309

- generateReceiverJson: replace sprintf with safe_snprintf
- Beast escape scan: add sanity limit on eom growth
- view1090: check strdup return value
- demod_2400: replace assert with runtime check for signal power overlap

Fixes flightaware#309
@mutability mutability added the LLM has LLM-generated content, treat with extreme suspicion label Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LLM has LLM-generated content, treat with extreme suspicion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden C backend: defensive checks across net_io, view1090, and demod

2 participants