diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2018-08-04 13:16:51 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2018-08-04 13:16:51 -0400 |
commit | 75677f69153b221da611568be7f578b9e99c5876 (patch) | |
tree | 371edbca5f6aa23985bc136059a02513401184e8 | |
parent | f41d577b6352e80919469ee1724a0b9ad4359e67 (diff) | |
download | gpsd-75677f69153b221da611568be7f578b9e99c5876.tar.gz |
Reject AIVDM armoring containing non-ASCII characters;
that would have to be wrong.
-rw-r--r-- | drivers.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -1406,6 +1406,15 @@ static bool aivdm_decode(const char *buf, size_t buflen, return false; } + /* discard sentences with high-half characters in them, they're corrupted */ + for (cp = buf; *cp; cp++) { + if (!isascii(*cp)) { + gpsd_log(&session->context->errout, LOG_ERROR, + "corrupted AIVDM packet.\n"); + return false; + } + } + /* extract packet fields */ (void)strlcpy((char *)fieldcopy, buf, sizeof(fieldcopy)); field[nfields++] = (unsigned char *)buf; |