Skip to content
Snippets Groups Projects
Commit 3c69875a authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix CID 487672: Dereference null return value

gmtime_r() can return NULL
parent e4f24342
Branches
Tags
1 merge request!455Update branch with changes from master
...@@ -29,11 +29,15 @@ time_t checktime(void) ...@@ -29,11 +29,15 @@ time_t checktime(void)
time_t t=0x2D24BD00L; /* Correct time_t value on Jan-1-1994 */ time_t t=0x2D24BD00L; /* Correct time_t value on Jan-1-1994 */
struct tm gmt; struct tm gmt;
struct tm tm; struct tm tm;
struct tm* tmp;
memset(&tm,0,sizeof(tm)); memset(&tm,0,sizeof(tm));
tm.tm_year=94; tm.tm_year=94;
tm.tm_mday=1; tm.tm_mday=1;
return mktime(&tm) - mktime(gmtime_r(&t,&gmt)); tmp = gmtime_r(&t,&gmt);
if(tmp == NULL)
return -1;
return mktime(&tm) - mktime(tmp);
} }
/* Compensates for struct tm "weirdness" */ /* Compensates for struct tm "weirdness" */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment