diff options
author | Gary E. Miller <gem@rellim.com> | 2018-07-14 12:17:35 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2018-07-14 12:17:35 -0700 |
commit | 6bba8b329fc7687b15863d30471d5af402467802 (patch) | |
tree | 10975c312ee76bf58c4f66b6997e07c4f5e5e4c3 /test_libgps.c | |
parent | 692427a17aeb54d69826def759cc1f1da605ba33 (diff) | |
download | gpsd-6bba8b329fc7687b15863d30471d5af402467802.tar.gz |
gps_read(): fix some nasty buffer overruns and corruptions.
Now pass an optional message buffer to gps_read(). Finally
the JSON display in cgps works.
Thanks to Virgin Orbit for their support fixing this bug.
Diffstat (limited to 'test_libgps.c')
-rw-r--r-- | test_libgps.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test_libgps.c b/test_libgps.c index 933beba0..d0837188 100644 --- a/test_libgps.c +++ b/test_libgps.c @@ -1,6 +1,7 @@ /* * A simple command-line exerciser for the library. * Not really useful for anything but debugging. + * SPDX-License-Identifier: BSD-2-clause */ #include <stdio.h> #include <stdlib.h> @@ -111,7 +112,7 @@ int main(int argc, char *argv[]) "test_libgps: gps send error: %d, %s\n", errno, gps_errstr(errno)); } - if (gps_read(&collect) == -1) { + if (gps_read(&collect, NULL, 0) == -1) { (void)fprintf(stderr, "test_libgps: gps read error: %d, %s\n", errno, gps_errstr(errno)); @@ -137,7 +138,7 @@ int main(int argc, char *argv[]) } collect.set = 0; (void)gps_send(&collect, buf); - (void)gps_read(&collect); + (void)gps_read(&collect, NULL, 0); #ifdef SOCKET_EXPORT_ENABLE #ifdef LIBGPS_DEBUG libgps_dump_state(&collect); |