-
Notifications
You must be signed in to change notification settings - Fork 20
RDKB-61923: Coverity Cleanup -Y2K38_SAFETY #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /* | ||
| * If not stated otherwise in this file or this component's Licenses.txt file the | ||
|
Check failure on line 2 in source/util_api/ansc/AnscPlatform/user_time.c
|
||
| * following copyright and licenses apply: | ||
| * | ||
| * Copyright 2015 RDK Management | ||
|
|
@@ -71,6 +71,11 @@ | |
| 04/03/02 adapted to linux user by Ying Lou | ||
|
|
||
| **********************************************************************/ | ||
| #define _TIME_BITS 64 | ||
| #define _FILE_OFFSET_BITS 64 | ||
| #include <sys/types.h> | ||
| #include "time.h" | ||
|
|
||
| #include "user_base.h" | ||
| #include "user_time.h" | ||
| #include "safec_lib_common.h" | ||
|
|
@@ -388,9 +393,9 @@ | |
| unsigned long | ||
| UserGetUtcSeconds( void ) | ||
| { | ||
| time_t timeNow; | ||
| int64_t timeNow; | ||
|
|
||
| UserGetNtpTime(&timeNow); | ||
| UserGetNtpTime((time_t*)&timeNow); | ||
|
|
||
| return timeNow; | ||
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting a pointer to
int64_ttotime_t*is unsafe. With_TIME_BITS 64enabled,time_tshould already be 64-bit, so a localtime_tvariable should be used instead. This avoids potential aliasing issues and undefined behavior. Consider:time_t timeNow; UserGetNtpTime(&timeNow); return (unsigned long)timeNow;or change the return type to match the actual data type.