diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-01-30 10:08:51 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-01-30 10:10:07 -0500 |
commit | 7de7d9791e85a5a1b2895c111e00a61f3fad76a0 (patch) | |
tree | 0b38a4ff8c780bec31f6ca12591bf0bff6acbeee /gpsd_json.c | |
parent | a902bbe2261bbb990fdd1ebdcdae6ff52ae5d6eb (diff) | |
download | gpsd-7de7d9791e85a5a1b2895c111e00a61f3fad76a0.tar.gz |
Assertions cleanup and new policy. All regression tests pass.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r-- | gpsd_json.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gpsd_json.c b/gpsd_json.c index ee4fb708..d53e6ce3 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -131,7 +131,7 @@ void json_tpv_dump(const struct gps_device_t *session, timestamp_t rtime = timestamp(); #endif /* TIMING_ENABLE */ - assert(replylen > 2); + assert(replylen > sizeof(char *)); (void)strlcpy(reply, "{\"class\":\"TPV\",", replylen); if (gpsdata->dev.path[0] != '\0') str_appendf(reply, replylen, "\"device\":\"%s\",", gpsdata->dev.path); @@ -213,7 +213,7 @@ void json_noise_dump(const struct gps_data_t *gpsdata, { char tbuf[JSON_DATE_MAX+1]; - assert(replylen > 2); + assert(replylen > sizeof(char *)); (void)strlcpy(reply, "{\"class\":\"GST\",", replylen); if (gpsdata->dev.path[0] != '\0') str_appendf(reply, replylen, "\"device\":\"%s\",", gpsdata->dev.path); @@ -244,7 +244,7 @@ void json_sky_dump(const struct gps_data_t *datap, { int i, reported = 0; - assert(replylen > 2); + assert(replylen > sizeof(char *)); (void)strlcpy(reply, "{\"class\":\"SKY\",", replylen); if (datap->dev.path[0] != '\0') str_appendf(reply, replylen, "\"device\":\"%s\",", datap->dev.path); @@ -3294,7 +3294,7 @@ void json_att_dump(const struct gps_data_t *gpsdata, /*@out@*/ char *reply, size_t replylen) /* dump the contents of an attitude_t structure as JSON */ { - assert(replylen > 2); + assert(replylen > sizeof(char *)); (void)strlcpy(reply, "{\"class\":\"ATT\",", replylen); str_appendf(reply, replylen, "\"device\":\"%s\",", gpsdata->dev.path); if (isnan(gpsdata->attitude.heading) == 0) { |