From: Alexander Couzens Date: Fri, 29 Jun 2018 21:19:11 +0000 (+0200) Subject: nmea.c: Add null byte to nmea fields X-Git-Url: http://git.openwrt.org/source?a=commitdiff_plain;h=ccabdf6c235f1e05b2eaf7a418f7e8450652f381;p=project%2Fugps.git nmea.c: Add null byte to nmea fields Either the main.c treat them as non-null terminated strings or nmea adds a null byte to the fields. Found-by: Coverity Fixes CID 1431321 1431098 --- diff --git a/nmea.c b/nmea.c index 73ee722..4a49528 100644 --- a/nmea.c +++ b/nmea.c @@ -51,7 +51,7 @@ struct nmea_param { } nmea_params[MAX_NMEA_PARAM]; static int nmea_bad_time; -char longitude[32] = { 0 }, latitude[32] = { 0 }, course[16] = { 0 }, speed[16] = { 0 }, elevation[16] = { 0 }; +char longitude[33] = { 0 }, latitude[33] = { 0 }, course[17] = { 0 }, speed[17] = { 0 }, elevation[17] = { 0 }; int gps_valid = 0; static void diff --git a/nmea.h b/nmea.h index c6f1896..9f46d29 100644 --- a/nmea.h +++ b/nmea.h @@ -23,7 +23,7 @@ #include -extern char longitude[32], latitude[32], course[16], speed[16], elevation[16]; +extern char longitude[33], latitude[33], course[17], speed[17], elevation[17]; extern int nmea_open(char *dev, struct ustream_fd *s, speed_t speed); extern void gps_timestamp(void); extern unsigned int adjust_clock;