summaryrefslogtreecommitdiff
path: root/driver_ais.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2013-10-14 07:42:40 -0400
committerEric S. Raymond <esr@thyrsus.com>2013-10-14 07:42:40 -0400
commit119308bff984bc83741c22a78ab3074a8c6278de (patch)
tree2d5018dd1027089e90675b482cac6484a46c0b24 /driver_ais.c
parentad8f509d4808b9564dae4493178cb41bb1e41bf9 (diff)
downloadgpsd-119308bff984bc83741c22a78ab3074a8c6278de.tar.gz
Be more relaxed about AIS Type 5 message lengths.
Diffstat (limited to 'driver_ais.c')
-rw-r--r--driver_ais.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/driver_ais.c b/driver_ais.c
index cd43a789..b1d1bc27 100644
--- a/driver_ais.c
+++ b/driver_ais.c
@@ -139,7 +139,12 @@ bool ais_binary_decode(const int debug,
gpsd_report(debug, LOG_WARN,
"AIVDM message type 5 size not 424 bits (%zd).\n",
bitlen);
- return false;
+ /*
+ * For unknown reasons, a lot of transmitters in the wild ship
+ * with a length of 420 or 422. This is a recoverable error.
+ */
+ if (bitlen < 420)
+ return false;
}
ais->type5.ais_version = UBITS(38, 2);
ais->type5.imo = UBITS(40, 30);
@@ -157,7 +162,8 @@ bool ais_binary_decode(const int debug,
ais->type5.minute = UBITS(288, 6);
ais->type5.draught = UBITS(294, 8);
UCHARS(302, ais->type5.destination);
- ais->type5.dte = UBITS(422, 1);
+ if (bitlen >= 423)
+ ais->type5.dte = UBITS(422, 1);
//ais->type5.spare = UBITS(423, 1);
break;
case 6: /* Addressed Binary Message */