summaryrefslogtreecommitdiff
path: root/driver_nmea0183.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-03-14 14:47:54 -0700
committerGary E. Miller <gem@rellim.com>2019-03-14 14:47:54 -0700
commit84bd85b418a39d07dfce8a25c921c2b81d1b0371 (patch)
treed8128103988d4b259e52992ce3bc50fbcdc59029 /driver_nmea0183.c
parent1f732455a83c30108826bdc947c84ec462dc7b82 (diff)
downloadgpsd-84bd85b418a39d07dfce8a25c921c2b81d1b0371.tar.gz
driver_nmea: Fix potential segfault w/ DD() in merge_ddmmyy()
Diffstat (limited to 'driver_nmea0183.c')
-rw-r--r--driver_nmea0183.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c
index 30e07f88..13cc237f 100644
--- a/driver_nmea0183.c
+++ b/driver_nmea0183.c
@@ -130,9 +130,9 @@ static int faa_mode(char mode)
*/
static int merge_ddmmyy(char *ddmmyy, struct gps_device_t *session)
{
- int yy = DD(ddmmyy + 4);
- int mon = DD(ddmmyy + 2);
- int mday = DD(ddmmyy);
+ int yy;
+ int mon;
+ int mday;
int year;
int i;
@@ -156,6 +156,7 @@ static int merge_ddmmyy(char *ddmmyy, struct gps_device_t *session)
return 3;
}
+ /* should be no defects left to segfault DD() */
yy = DD(ddmmyy + 4);
mon = DD(ddmmyy + 2);
mday = DD(ddmmyy);