diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-08-24 11:49:53 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-08-24 11:49:53 -0400 |
commit | 5ee8b5f73f0b0b01321b853d0c27902452a21397 (patch) | |
tree | 08835984edd147509695204bd3f98ed6633f970d /drivers.c | |
parent | 617ade42a61cdddd6eb6ebd89711c7adf6275a1f (diff) | |
download | gpsd-5ee8b5f73f0b0b01321b853d0c27902452a21397.tar.gz |
Add a minor error check to AIVDM parsing.
Diffstat (limited to 'drivers.c')
-rw-r--r-- | drivers.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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]; |