Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overflow fix #40

Merged
merged 2 commits into from
Apr 9, 2019
Merged

Overflow fix #40

merged 2 commits into from
Apr 9, 2019

Conversation

wiedehopf
Copy link

This PR fixes some errors with piaware reported by users here:
https://discussions.flightaware.com/t/announcing-piaware-3-latest-version-3-6-3/18829/959?u=wiedehopf

The first commit should in most practical situations fix both errors as the overrun should no longer happen.

The second commit is just to ensure that should the TSV packet for some reason grow further no crashes are caused by an overrun.

Due to commit 45886ed
faup1090: write _v on every line, bump TSV_VERSION
and maybe other changes the TSV packets are bigger and some users have
reported the following error:
piaware[9040]: faup1090(27427): fatsv: output too large (max 600, overran by 20)

Fix this error by increasing TSV_MAX_PACKET_SIZE to 800
If the \n termination of TSV messages is missing, faup1090 encounters
the following error:
Caught background error: list must have an even number of elements
    while executing
"array set row [split $line "\t"]"
    (object "::faup1090" method "::FaupConnection::data_available" body line 28)

This missing termination with \n can happen when p == end is true in the
overrun check. vsnprintf will always terminate the string with \0, so if
the vsnprintf is called to write the to the last position in the buffer
(end-1), it will write \0 instead to terminate the string as not to
overflow the buffer.
To catch that possibility the overrun check is changed to p < end as
then vsnprintf is assured to have had enough room to write the \0
termination to end-1.
@eric1tran eric1tran merged commit d54c452 into flightaware:dev Apr 9, 2019
@eric1tran
Copy link

Thanks @wiedehopf !

@wiedehopf wiedehopf deleted the overflow_fix branch April 9, 2019 16:26
kpetrilli pushed a commit to kpetrilli/dump1090 that referenced this pull request Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants