RTEMS | timespecaddto.c: Use of 32-bit time_t (#5107)
Joel Sherrill (@joel)
gitlab at rtems.org
Wed Aug 7 21:57:15 UTC 2024
Joel Sherrill created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5107
Assignee: Joel Sherrill
## Summary
Coverity CID 1512527
Coverity spotted this where time_t variables/structure elements are assigned to uint32_t. Notice that the return type is uint32_t which propagates to callers of this such as rtems_timespec_add_to().
```
46 uint32_t _Timespec_Add_to(
47 struct timespec *time,
48 const struct timespec *add
49)
50{
CID 1512527: (#1 of 1): 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 add->tv_sec is cast to uint32_t.
51 uint32_t seconds = add->tv_sec;
```
## Steps to reproduce
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5107
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/20240807/0571602e/attachment.htm>
More information about the bugs
mailing list