summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-01-23 22:16:36 -0800
committerKeith Packard <keithp@keithp.com>2014-01-23 22:17:40 -0800
commitdd28429405498fca0788ce9c19093898c84b10e5 (patch)
tree08775d5bb3786860631d795ccd6bd387bbc965ad
parentafbae4c6b7a658f690cb827acfef015e9e2da318 (diff)
altoslib: Validate TeleMega GPS_SAT log packet nsat
Make sure nsat is not more than the size of the array Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altoslib/AltosEepromMega.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java
index 1ac72b1c..b8a1b9e8 100644
--- a/altoslib/AltosEepromMega.java
+++ b/altoslib/AltosEepromMega.java
@@ -24,6 +24,8 @@ import java.text.*;
public class AltosEepromMega extends AltosEeprom {
public static final int record_length = 32;
+ public static final int max_sat = 12;
+
public int record_length() { return record_length; }
/* AO_LOG_FLIGHT elements */
@@ -176,6 +178,8 @@ public class AltosEepromMega extends AltosEeprom {
gps = state.make_temp_gps(true);
int n = nsat();
+ if (n > max_sat)
+ n = max_sat;
for (int i = 0; i < n; i++)
gps.add_sat(svid(i), c_n(i));
break;