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
This commit is contained in:
parent
cdba7566fd
commit
9c124b3f2b
2
net_io.c
2
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] +
|
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));
|
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
|
// overran the buffer
|
||||||
int used = line_start - buf;
|
int used = line_start - buf;
|
||||||
buflen *= 2;
|
buflen *= 2;
|
||||||
|
|
Loading…
Reference in a new issue