Package: gpsd Version: 3.25-2 Severity: minor Tags: patch upstream Dear Maintainer,
I hope this message finds you well. I've noticed an issue in the `driver_ubx.c` file that might be worth your attention. In the drivers/driver_ubx.c file, there are two occurrences of "359 > tmp" (lines 2017 and 2465). However, when azimuth is set to 359 degrees, it's reported as "n/a" due to too strict upper bound checking. To fix this issue, I suggest replacing both occurrences of "359 > tmp" with "360 > tmp". This should allow the code to handle azimuth value of 359 degrees correctly. Additionally, I noticed that there's a conversion to double before assignment to `tmp` on line 2464, which is unnecessary and can be removed. I've attached a patch file that includes these changes. Thank you for your time and attention!
diff --git a/drivers/driver_ubx.c b/drivers/driver_ubx.c index 7803449..f336120 100644 --- a/drivers/driver_ubx.c +++ b/drivers/driver_ubx.c @@ -2014,7 +2014,7 @@ static gps_mask_t ubx_msg_nav_sat(struct gps_device_t *session, session->gpsdata.skyview[st].elevation = (double)tmp; } tmp = getles16(buf, off + 4); - if (359 > tmp && 0 <= tmp) { + if (360 > tmp && 0 <= tmp) { session->gpsdata.skyview[st].azimuth = (double)tmp; } session->gpsdata.skyview[st].used = used; @@ -2461,8 +2461,8 @@ ubx_msg_nav_svinfo(struct gps_device_t *session, unsigned char *buf, if (90 >= abs(tmp)) { session->gpsdata.skyview[st].elevation = (double)tmp; } - tmp = (double)getles16(buf, off + 6); - if (359 > tmp && 0 <= tmp) { + tmp = getles16(buf, off + 6); + if (360 > tmp && 0 <= tmp) { session->gpsdata.skyview[st].azimuth = (double)tmp; } session->gpsdata.skyview[st].used = used;