diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2012-05-09 22:51:01 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2012-05-09 22:51:42 -0400 |
commit | 9d7dc31b595b91aeb258faca459909b0b5b7965e (patch) | |
tree | 18e6760d0e11e89cd8db552a46748341575b3e61 /net_ntrip.c | |
parent | dbf6d322945e68fce36afd6dba75ab56d60b0c86 (diff) | |
download | gpsd-9d7dc31b595b91aeb258faca459909b0b5b7965e.tar.gz |
More Coverity-spawned fixes. All regression tests pass.
Diffstat (limited to 'net_ntrip.c')
-rw-r--r-- | net_ntrip.c | 18 |
1 files changed, 12 insertions, 6 deletions
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) { |