diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-03-29 06:41:09 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-03-29 06:41:09 -0400 |
commit | 3ef1d9ecbef54ba5e4e6a8167a8dd5c5723aa94f (patch) | |
tree | b7dcab4eb669ca6fe3fc18bd672bc53e5a3d2c57 /driver_garmin_txt.c | |
parent | c48d0caf13ce030166fedad354e4732584584f50 (diff) | |
download | gpsd-3ef1d9ecbef54ba5e4e6a8167a8dd5c5723aa94f.tar.gz |
Magic-number and strncpy elimination. All regression tests pass
Diffstat (limited to 'driver_garmin_txt.c')
-rw-r--r-- | driver_garmin_txt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/driver_garmin_txt.c b/driver_garmin_txt.c index 74b1ce57..c67a39b3 100644 --- a/driver_garmin_txt.c +++ b/driver_garmin_txt.c @@ -156,7 +156,7 @@ static int gar_decode(const char *data, const size_t length, const char *prefix, } bzero(buf, (int)sizeof(buf)); - (void)strncpy(buf, data, length); + (void)strlcpy(buf, data, length); gpsd_report(LOG_RAW + 2, "Decoded string: %s\n", buf); if (strchr(buf, '_') != NULL) { @@ -224,7 +224,7 @@ static int gar_int_decode(const char *data, const size_t length, } bzero(buf, (int)sizeof(buf)); - (void)strncpy(buf, data, length); + (void)strlcpy(buf, data, length); gpsd_report(LOG_RAW + 2, "Decoded string: %s\n", buf); if (strchr(buf, '_') != NULL) { @@ -277,7 +277,7 @@ gps_mask_t garmintxt_parse(struct gps_device_t * session) session->packet.type = GARMINTXT_PACKET; /* TAG message as GTXT, Garmin Simple Text Message */ - strncpy(session->gpsdata.tag, "GTXT", MAXTAGLEN); + (void)strlcpy(session->gpsdata.tag, "GTXT", MAXTAGLEN); /* only one message, set cycle start */ session->cycle_end_reliable = true; |