summaryrefslogtreecommitdiff
path: root/drivers.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-24 11:49:53 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-24 11:49:53 -0400
commit5ee8b5f73f0b0b01321b853d0c27902452a21397 (patch)
tree08835984edd147509695204bd3f98ed6633f970d /drivers.c
parent617ade42a61cdddd6eb6ebd89711c7adf6275a1f (diff)
downloadgpsd-5ee8b5f73f0b0b01321b853d0c27902452a21397.tar.gz
Add a minor error check to AIVDM parsing.
Diffstat (limited to 'drivers.c')
-rw-r--r--drivers.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers.c b/drivers.c
index 1e809e5e..eb8a41ee 100644
--- a/drivers.c
+++ b/drivers.c
@@ -1218,7 +1218,6 @@ static bool aivdm_decode(const char *buf, size_t buflen,
}
switch (field[4][0]) {
- /* FIXME: if fields[4] == "12", it doesn't detect the error */
case '\0':
/*
* Apparently an empty channel is normal for AIVDO sentences,
@@ -1232,6 +1231,11 @@ static bool aivdm_decode(const char *buf, size_t buflen,
session->driver.aivdm.ais_channel ='A';
break;
case '1':
+ if (strcmp((char *)field[4], (char *)"12") == 0) {
+ gpsd_report(session->context->debug, LOG_INF,
+ "ignoring bogus AIS channel '12'.\n");
+ return false;
+ }
/*@fallthrough@*/
case 'A':
ais_context = &session->driver.aivdm.context[0];