mirror of https://github.com/moparisthebest/curl
dates from 2038 or later now return 0x7fffffff when 32 bit time_t is used
This commit is contained in:
parent
8ef8e949bd
commit
cd73a733c7
5
CHANGES
5
CHANGES
|
@ -6,6 +6,11 @@
|
||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Daniel (11 November 2004)
|
||||||
|
- Jeff Phillips found out that a date string with a year beyond 2038 could
|
||||||
|
crash the new date parser on systems with 32bit time_t. We now check for
|
||||||
|
this case and deal with it.
|
||||||
|
|
||||||
Daniel (10 November 2004)
|
Daniel (10 November 2004)
|
||||||
- I installed Heimdal on my Debian box (using the debian package) and noticed
|
- I installed Heimdal on my Debian box (using the debian package) and noticed
|
||||||
that configure --with-gssapi failed to create a nice build. Fixed now.
|
that configure --with-gssapi failed to create a nice build. Fixed now.
|
||||||
|
|
|
@ -1171,6 +1171,7 @@ AC_CHECK_SIZEOF(curl_off_t, ,[
|
||||||
])
|
])
|
||||||
AC_CHECK_SIZEOF(size_t)
|
AC_CHECK_SIZEOF(size_t)
|
||||||
AC_CHECK_SIZEOF(long)
|
AC_CHECK_SIZEOF(long)
|
||||||
|
AC_CHECK_SIZEOF(time_t)
|
||||||
|
|
||||||
AC_CHECK_TYPE(long long,
|
AC_CHECK_TYPE(long long,
|
||||||
[AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
|
[AC_DEFINE(HAVE_LONGLONG, 1, [if your compiler supports long long])]
|
||||||
|
|
|
@ -83,6 +83,9 @@ only ones RFC2616 says HTTP applications may use.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
This function returns -1 when it fails to parse the date string. Otherwise it
|
This function returns -1 when it fails to parse the date string. Otherwise it
|
||||||
returns the number of seconds as described.
|
returns the number of seconds as described.
|
||||||
|
|
||||||
|
If the year is larger than 2037 on systems with 32 bit time_t, this function
|
||||||
|
will return 0x7fffffff (since that is the largest possible 31 bit number).
|
||||||
.SH REWRITE
|
.SH REWRITE
|
||||||
The former version of this function was built with yacc and was not only very
|
The former version of this function was built with yacc and was not only very
|
||||||
large, it was also never quite understood and it wasn't possible to build with
|
large, it was also never quite understood and it wasn't possible to build with
|
||||||
|
|
|
@ -350,6 +350,12 @@ static time_t Curl_parsedate(const char *date)
|
||||||
/* lacks vital info, fail */
|
/* lacks vital info, fail */
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
#if SIZEOF_TIME_T < 5
|
||||||
|
/* 32 bit time_t can only hold dates to the beginning of 2038 */
|
||||||
|
if(yearnum > 2037)
|
||||||
|
return 0x7fffffff;
|
||||||
|
#endif
|
||||||
|
|
||||||
tm.tm_sec = secnum;
|
tm.tm_sec = secnum;
|
||||||
tm.tm_min = minnum;
|
tm.tm_min = minnum;
|
||||||
tm.tm_hour = hournum;
|
tm.tm_hour = hournum;
|
||||||
|
|
|
@ -287,6 +287,11 @@ typedef int curl_socket_t;
|
||||||
#define USE_LIBIDN
|
#define USE_LIBIDN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SIZEOF_TIME_T
|
||||||
|
/* assume default size of time_t to be 32 bit */
|
||||||
|
#define SIZEOF_TIME_T 4
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LIBIDN_REQUIRED_VERSION "0.4.1"
|
#define LIBIDN_REQUIRED_VERSION "0.4.1"
|
||||||
|
|
||||||
#endif /* __CONFIG_H */
|
#endif /* __CONFIG_H */
|
||||||
|
|
Loading…
Reference in New Issue