RTEMS | kern_ntptime.c: Assigning time_t to 32-bit variable truncates time (#5111)
Joel Sherrill (@joel)
gitlab at rtems.org
Thu Aug 8 16:08:42 UTC 2024
Joel Sherrill created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5111
Assignee: Joel Sherrill
## Summary
Coverity CID 1512505
Line 983 assigns the tv_sec (time_t) value to pps_lastsec (long). long is 32-bits on RTEMS 32-bit targets and time_t is always 64-bits. The solution should be to use time_t for pps_lastsec.
```
981 pps_calcnt++;
982 v_nsec = -pps_fcount;
CID 1512505: (#2 of 2): Use of 32-bit time_t (Y2K38_SAFETY)
1. store_truncates_time_t: A time_t value is stored in an integer with too few bits to accommodate it. The expression pps_tf[0].tv_sec is cast to long.
983 pps_lastsec = pps_tf[0].tv_sec;
```
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5111
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240808/3fa813f7/attachment.htm>
More information about the bugs
mailing list