diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2004-08-26 01:40:48 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2004-08-26 01:40:48 +0000 |
commit | 330ba28f7f33068e963e68b65b622006716499d6 (patch) | |
tree | 4b34c8a188d7ce727d7a3cffe77fbffcfb485b25 /nmea_parse.c | |
parent | 00b0aa90f79ac9d9afda48d9eb715a2b90d1efbe (diff) | |
download | gpsd-330ba28f7f33068e963e68b65b622006716499d6.tar.gz |
Fix a *nasty* array-overrun bug. The old code was using the "used"
array as a bit vector with satellite PRNS as indices -- but the array
mas only length 12 (number of channels) rather than 32 (number of
satellites.) Any used satellitle with PRN above 11 would stomp on
a word of someone else's data.
I'm thinking this might have been the source of some of Dragorn's
corruption reports.
Diffstat (limited to 'nmea_parse.c')
-rw-r--r-- | nmea_parse.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/nmea_parse.c b/nmea_parse.c index ebf7c986..691292a1 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -348,8 +348,7 @@ static void processGPGSA(char *sentence, struct gps_data_t *out) out->used[i] = 0; out->satellites_used = 0; for (i = 0; i < MAXCHANNELS; i++) { - out->used[atoi(field(sentence, i))] = 1; - out->satellites_used++; + out->used[out->satellites_used++] = atoi(field(sentence, i)); } out->fix_quality_stamp.changed = changed; REFRESH(out->fix_quality_stamp); |