Fix #37: crash when updating a callsign database on MD-2017, and it does not fit.

This commit is contained in:
Serge Vakulenko 2019-09-17 19:55:54 -07:00
parent 8bc1dde781
commit 511ed5cfe3
2 changed files with 8 additions and 2 deletions

View File

@ -2863,8 +2863,9 @@ static void d868uv_write_csv(radio_device_t *radio, FILE *csv)
// Add map record. // Add map record.
if (sz.count >= NCALLSIGNS) { if (sz.count >= NCALLSIGNS) {
fprintf(stderr, "Too many contacts!\n"); fprintf(stderr, "WARNING: Too many callsigns!\n");
return; fprintf(stderr, "Skipping the rest.\n");
break;
} }
callsign_map_t *m = &map[sz.count]; callsign_map_t *m = &map[sz.count];
sz.count++; sz.count++;

View File

@ -2454,6 +2454,11 @@ static void uv380_write_csv(radio_device_t *radio, FILE *csv)
} }
cs = GET_CALLSIGN(mem, nrecords); cs = GET_CALLSIGN(mem, nrecords);
if ((uint8_t*) (cs + 1) > &mem[nbytes]) {
fprintf(stderr, "WARNING: Too many callsigns!\n");
fprintf(stderr, "Skipping the rest.\n");
break;
}
nrecords++; nrecords++;
// Fill callsign structure. // Fill callsign structure.