summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens2018-06-29 21:19:11 +0000
committerJohn Crispin2018-07-12 07:59:06 +0000
commitccabdf6c235f1e05b2eaf7a418f7e8450652f381 (patch)
treed7e143ec250c7362354dbd341bd586a44d597494
parentcdc1478a8133bec40cdf2daf05640c22e6126aa0 (diff)
downloadugps-ccabdf6c235f1e05b2eaf7a418f7e8450652f381.tar.gz
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
-rw-r--r--nmea.c2
-rw-r--r--nmea.h2
2 files changed, 2 insertions, 2 deletions
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 <libubox/ustream.h>
-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;