summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2012-05-09 22:51:01 -0400
committerEric S. Raymond <esr@thyrsus.com>2012-05-09 22:51:42 -0400
commit9d7dc31b595b91aeb258faca459909b0b5b7965e (patch)
tree18e6760d0e11e89cd8db552a46748341575b3e61
parentdbf6d322945e68fce36afd6dba75ab56d60b0c86 (diff)
downloadgpsd-9d7dc31b595b91aeb258faca459909b0b5b7965e.tar.gz
More Coverity-spawned fixes. All regression tests pass.
-rw-r--r--driver_ubx.c2
-rw-r--r--gpsdecode.c5
-rw-r--r--net_ntrip.c18
3 files changed, 16 insertions, 9 deletions
diff --git a/driver_ubx.c b/driver_ubx.c
index b8004f46..b7d102d4 100644
--- a/driver_ubx.c
+++ b/driver_ubx.c
@@ -714,7 +714,7 @@ static bool ubx_speed(struct gps_device_t *session,
usart_mode |= 0x2000; /* zero value means 1 stop bit */
putle32(buf, 4, usart_mode);
putle32(buf, 8, speed);
- (void)ubx_write(session, 0x06, 0x00, &buf[6], 20); /* send back with all other settings intact */
+ (void)ubx_write(session, 0x06, 0x00, buf, sizeof(buf)); /* send back with all other settings intact */
/*@ -charint +usedef +compdef */
return true;
}
diff --git a/gpsdecode.c b/gpsdecode.c
index 87506b63..4588649f 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -428,12 +428,13 @@ static void decode(FILE *fpin, FILE*fpout)
(void)fputs("\n", fpout);
}
#ifdef SOCKET_EXPORT_ENABLE
- else
+ else {
json_data_report(changed,
&session, &policy,
buf, sizeof(buf));
+ (void)fputs(buf, fpout);
+ }
#endif /* SOCKET_EXPORT_ENABLE */
- (void)fputs(buf, fpout);
#ifdef AIVDM_ENABLE
} else if (session.packet.type == AIVDM_PACKET) {
if ((changed & AIS_SET)!=0) {
diff --git a/net_ntrip.c b/net_ntrip.c
index a107de7b..048c4e08 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -494,12 +494,18 @@ int ntrip_open(struct gps_device_t *device, char *caster)
(void)strlcpy(device->ntrip.stream.credentials,
auth,
sizeof(device->ntrip.stream.credentials));
- (void)strlcpy(device->ntrip.stream.url,
- url,
- sizeof(device->ntrip.stream.url));
- (void)strlcpy(device->ntrip.stream.port,
- port,
- sizeof(device->ntrip.stream.port));
+ /*
+ * Semantically url and port ought to be non-NULL by now,
+ * but just in case...this code appeases Coverity.
+ */
+ if (url != NULL)
+ (void)strlcpy(device->ntrip.stream.url,
+ url,
+ sizeof(device->ntrip.stream.url));
+ if (port != NULL)
+ (void)strlcpy(device->ntrip.stream.port,
+ port,
+ sizeof(device->ntrip.stream.port));
ret = ntrip_stream_req_probe(&device->ntrip.stream);
if (ret == -1) {