summaryrefslogtreecommitdiff
path: root/gpsctl.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-07-14 12:17:35 -0700
committerGary E. Miller <gem@rellim.com>2018-07-14 12:17:35 -0700
commit6bba8b329fc7687b15863d30471d5af402467802 (patch)
tree10975c312ee76bf58c4f66b6997e07c4f5e5e4c3 /gpsctl.c
parent692427a17aeb54d69826def759cc1f1da605ba33 (diff)
downloadgpsd-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 'gpsctl.c')
-rw-r--r--gpsctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gpsctl.c b/gpsctl.c
index 9a425f16..b38143ac 100644
--- a/gpsctl.c
+++ b/gpsctl.c
@@ -127,7 +127,7 @@ static bool gps_query(struct gps_data_t *gpsdata,
gpsd_log(&context.errout, LOG_PROG, "reading...\n");
- (void)gps_read(gpsdata);
+ (void)gps_read(gpsdata, NULL, 0);
if (ERROR_SET & gpsdata->set) {
gpsd_log(&context.errout, LOG_ERROR, "error '%s'\n", gpsdata->error);
return false;
@@ -437,7 +437,7 @@ int main(int argc, char **argv)
while (devcount > 0) {
errno = 0;
- if (gps_read(&gpsdata) == -1) {
+ if (gps_read(&gpsdata, NULL, 0) == -1) {
gpsd_log(&context.errout, LOG_ERROR, "data read failed.\n");
(void)gps_close(&gpsdata);
exit(EXIT_FAILURE);