diff options
author | Sven Geggus <lists@fuchsschwanzdomain.de> | 2018-09-04 19:55:50 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2018-09-04 19:58:18 -0700 |
commit | 92f3ebeb949e33ea24049d9c5c382d28d6786ec4 (patch) | |
tree | 26b4efa656e0b758b30d68b2c3197fef5a05dac9 /gpsd_json.c | |
parent | 2ad51d55e4f37373d62e853254476dd3ddb0f4d0 (diff) | |
download | gpsd-92f3ebeb949e33ea24049d9c5c382d28d6786ec4.tar.gz |
gpsd_json, AIS: add missing JSON terminators.
This could create unparseable JSON messages.
Including regression tests.
Signed-off-by: Gary E. Miller <gem@rellim.com>
Diffstat (limited to 'gpsd_json.c')
-rw-r--r-- | gpsd_json.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gpsd_json.c b/gpsd_json.c index 6b4c610e..ad412f44 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -1825,7 +1825,10 @@ void json_aivdm_dump(const struct ais_t *ais, switch (ais->type6.fid) { case 21: str_appendf(buf, buflen, - "\"country\":\"%s\",\"locode\":\"%s\",\"section\":\"%s\",\"terminal\":\"%s\",\"hectometre\":\"%s\",\"eta\":\"%u-%uT%u:%u\",\"tugs\":%u,\"airdraught\":%u}", + "\"country\":\"%s\",\"locode\":\"%s\"," + "\"section\":\"%s\",\"terminal\":\"%s\"," + "\"hectometre\":\"%s\",\"eta\":\"%u-%uT%u:%u\"," + "\"tugs\":%u,\"airdraught\":%u}\r\n", ais->type6.dac200fid21.country, ais->type6.dac200fid21.locode, ais->type6.dac200fid21.section, @@ -1844,7 +1847,7 @@ void json_aivdm_dump(const struct ais_t *ais, "\"section\":\"%s\"," "\"terminal\":\"%s\",\"hectometre\":\"%s\"," "\"eta\":\"%u-%uT%u:%u\"," - "\"status\":%u,\"status_text\":\"%s\"}", + "\"status\":%u,\"status_text\":\"%s\"}\r\n", ais->type6.dac200fid22.country, ais->type6.dac200fid22.locode, ais->type6.dac200fid22.section, @@ -1859,7 +1862,7 @@ void json_aivdm_dump(const struct ais_t *ais, break; case 55: str_appendf(buf, buflen, - "\"crew\":%u,\"passengers\":%u,\"personnel\":%u}", + "\"crew\":%u,\"passengers\":%u,\"personnel\":%u}\r\n", ais->type6.dac200fid55.crew, ais->type6.dac200fid55.passengers, |