Skip to content

fix: add NULL checks after strtok in handleFaupCommand - #306

Open
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/faup-null-deref
Open

fix: add NULL checks after strtok in handleFaupCommand#306
zagers wants to merge 1 commit into
flightaware:masterfrom
zagers:fix/faup-null-deref

Conversation

@zagers

@zagers zagers commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Adds NULL checks after strtok(NULL, "\t") calls in handleFaupCommand to prevent a crash when a client sends a field name without a corresponding value.

Changes

  • net_io.c: Added if (msg_field == NULL) break; after each strtok call that retrieves a value for upload_rate_multiplier and upload_unknown_commb

Motivation

A client connecting to the FAUP command port can send upload_rate_multiplier\t (with tab but no value). The strtok call returns NULL, which is passed to atof(), causing undefined behavior (typically a segfault).

Fixes #302

A client sending a field name without a value (e.g. 'upload_rate_multiplier\t')
caused strtok to return NULL, which was passed to atof/atoi, crashing the
process.

Fixes flightaware#302
@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.

NULL pointer dereference in handleFaupCommand via malformed input

2 participants