diff options
| author | Alexander Couzens | 2018-06-29 21:19:11 +0000 |
|---|---|---|
| committer | John Crispin | 2018-07-12 07:59:06 +0000 |
| commit | ccabdf6c235f1e05b2eaf7a418f7e8450652f381 (patch) | |
| tree | d7e143ec250c7362354dbd341bd586a44d597494 | |
| parent | cdc1478a8133bec40cdf2daf05640c22e6126aa0 (diff) | |
| download | ugps-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.c | 2 | ||||
| -rw-r--r-- | nmea.h | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -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 @@ -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; |