summaryrefslogtreecommitdiff
path: root/monitor_italk.c
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2009-03-04 16:57:09 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2009-03-04 16:57:09 +0000
commit56764b0b48fdcfbe32df1294306bd6982e274b75 (patch)
tree3755aa31e6e3f4f2919839502bc2ba23d6e14eed /monitor_italk.c
parent8a1f58de43ea5552e9fea97620f1a30c359e2b28 (diff)
downloadgpsd-56764b0b48fdcfbe32df1294306bd6982e274b75.tar.gz
fix another bug in the italk decoder.
bad PRN_STATUS messages can cause gpsd to run off the end of allocated space for SV info leading to a bus error later on when we try recalculate the DOPs.
Diffstat (limited to 'monitor_italk.c')
-rw-r--r--monitor_italk.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/monitor_italk.c b/monitor_italk.c
index 61e87ca4..6c7cbaa7 100644
--- a/monitor_italk.c
+++ b/monitor_italk.c
@@ -186,7 +186,9 @@ static void display_itk_prnstatus(unsigned char *buf, size_t len)
if (len < 62)
return;
- nchan = (unsigned int)((len - 10 - 52) / 10);
+ nchan = (unsigned int)getleuw(buf, 7 +50);
+ if (nchan > MAXCHANNELS)
+ nchan = MAXCHANNELS;
for (i = 0; i < nchan; i++) {
unsigned int off = 7+ 52 + 10 * i;
unsigned short fl;