diff --git a/drivers/gnss/gnss_nmea0183.c b/drivers/gnss/gnss_nmea0183.c index 9bce7a443a2..515606fbefe 100644 --- a/drivers/gnss/gnss_nmea0183.c +++ b/drivers/gnss/gnss_nmea0183.c @@ -538,7 +538,7 @@ int gnss_nmea0183_parse_gga(const char **argv, uint16_t argc, struct gnss_data * data->info.hdop = (uint16_t)tmp64; /* Parse altitude */ - if ((gnss_parse_dec_to_milli(argv[11], &tmp64) < 0) || + if ((gnss_parse_dec_to_milli(argv[9], &tmp64) < 0) || (tmp64 > INT32_MAX) || (tmp64 < INT32_MIN)) { return -EINVAL; diff --git a/tests/drivers/gnss/gnss_nmea0183/src/main.c b/tests/drivers/gnss/gnss_nmea0183/src/main.c index 680382f7dbc..43cd6a2e53f 100644 --- a/tests/drivers/gnss/gnss_nmea0183/src/main.c +++ b/tests/drivers/gnss/gnss_nmea0183/src/main.c @@ -330,7 +330,7 @@ ZTEST(gnss_nmea0183, test_parse_gga_fix) "Incorrectly parsed number of satelites"); zassert_equal(data.info.hdop, 1410, "Incorrectly parsed HDOP"); - zassert_equal(data.nav_data.altitude, 42371, "Incorrectly parsed altitude"); + zassert_equal(data.nav_data.altitude, 15234, "Incorrectly parsed altitude"); } ZTEST(gnss_nmea0183, test_snprintk)