Skip to content
Snippets Groups Projects
Commit 4fe669a9 authored by rswindell's avatar rswindell
Browse files

Fix observed NULL pointer deference (pass to sub_mkgmt(), from time_gm()).

Added comment about usage of gmtime() vs. gmtime_r().
parent 5cdb6fff
No related branches found
No related tags found
No related merge requests found
...@@ -428,8 +428,8 @@ time_gm(struct tm *tm) ...@@ -428,8 +428,8 @@ time_gm(struct tm *tm)
/* save value in case *tm is overwritten by gmtime() */ /* save value in case *tm is overwritten by gmtime() */
sec = tm->tm_sec; sec = tm->tm_sec;
tm2 = gmtime(&t); tm2 = gmtime(&t); /* why not use gmtime_r instead? */
if ((t2 = sub_mkgmt(tm2)) == (time_t) -1) if (tm2 == NULL || (t2 = sub_mkgmt(tm2)) == (time_t) -1)
return (time_t) -1; return (time_t) -1;
if (t2 < t || tm2->tm_sec != sec) { if (t2 < t || tm2->tm_sec != sec) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment