check bounds before casting (long long) to time_t
This commit is contained in:
parent
959241fe88
commit
3f79a49dd2
@ -208,6 +208,12 @@ time_t timegm(struct tm *tm)
|
|||||||
errno = EOVERFLOW;
|
errno = EOVERFLOW;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#if SIZEOF_TIME_T != 8
|
||||||
|
if (t > (long long)INT_MAX || t < (long long)INT_MIN) {
|
||||||
|
errno = EOVERFLOW;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
*tm = new;
|
*tm = new;
|
||||||
tm->tm_isdst = 0;
|
tm->tm_isdst = 0;
|
||||||
return t;
|
return t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user