From 9c124b3f2b3cd421148766457e56bb7d4a8a114e Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 31 Dec 2018 11:17:28 +0000 Subject: [PATCH 1/2] When generating aircraft.json, leave space for the final line. Otherwise if there are only a few bytes free at the end of the loop there's no space for the final line and it won't get appended. Should fix mutability/dump1090#240 --- net_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net_io.c b/net_io.c index 5148b6a..3bc2f85 100644 --- a/net_io.c +++ b/net_io.c @@ -1380,7 +1380,7 @@ char *generateAircraftJson(const char *url_path, int *len) { 10 * log10((a->signalLevel[0] + a->signalLevel[1] + a->signalLevel[2] + a->signalLevel[3] + a->signalLevel[4] + a->signalLevel[5] + a->signalLevel[6] + a->signalLevel[7] + 1e-5) / 8)); - if (p >= end) { + if ((p + 10) >= end) { // +10 to leave some space for the final line // overran the buffer int used = line_start - buf; buflen *= 2; From c05aea65a4efc70c28595e5c40db57055ffe592b Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 21 Jan 2019 20:11:12 +0000 Subject: [PATCH 2/2] Don't use DF18 when updating the known-Mode-S-address set. DF18 transponders don't necessarily do Mode S, so we shouldn't assume that Mode S messages from that address are valid merely because we heard a DF18. If it really is Mode S equipped, we should hear a DF11 at some point. --- mode_s.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mode_s.c b/mode_s.c index 606ddf7..e8387a1 100644 --- a/mode_s.c +++ b/mode_s.c @@ -681,12 +681,12 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg) mm->airground = AG_UNCERTAIN; } - if (!mm->correctedbits && (mm->msgtype == 17 || mm->msgtype == 18 || (mm->msgtype == 11 && mm->IID == 0))) { - // No CRC errors seen, and either it was an DF17/18 extended squitter + if (!mm->correctedbits && (mm->msgtype == 17 || (mm->msgtype == 11 && mm->IID == 0))) { + // No CRC errors seen, and either it was an DF17 extended squitter // or a DF11 acquisition squitter with II = 0. We probably have the right address. - // We wait until here to do this as we may have needed to decode an ES to note - // the type of address in DF18 messages. + // Don't do this for DF18, as a DF18 transmitter doesn't necessarily have a + // Mode S transponder. // NB this is the only place that adds addresses! icaoFilterAdd(mm->addr);