diff --git a/crypto/compat/timegm.c b/crypto/compat/timegm.c index 5a9e600..2658445 100644 --- a/crypto/compat/timegm.c +++ b/crypto/compat/timegm.c @@ -208,6 +208,12 @@ time_t timegm(struct tm *tm) errno = EOVERFLOW; 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->tm_isdst = 0; return t;