summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2018-08-31 16:41:57 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2018-08-31 16:41:57 +0000
commit1722e480eb06e4618f770e53ff8bfd0c98d48f56 (patch)
treef82d7db687aaff829c81d3dd199512415c514dde /time
parent40919f88bca20a30ae9c1b76d2c0f02df68488bb (diff)
downloadapr-1722e480eb06e4618f770e53ff8bfd0c98d48f56.tar.gz
Resolve invalid rvalue from void() function, the test is only required in one
single case of user-provided input, to avoid an index into invalid memory. Backports: 1839769 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1839770 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r--time/win32/time.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/time/win32/time.c b/time/win32/time.c
index 234979935..6ba92f1ca 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -108,6 +108,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
FileTimeToSystemTime(&ft, &st);
/* The Platform SDK documents that SYSTEMTIME/FILETIME are
* generally UTC, so no timezone info needed
+ * The time value makes a roundtrip, st cannot be invalid below.
*/
SystemTimeToAprExpTime(result, &st);
result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);
@@ -124,6 +125,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
FileTimeToSystemTime(&ft, &st);
/* The Platform SDK documents that SYSTEMTIME/FILETIME are
* generally UTC, so we will simply note the offs used.
+ * The time value makes a roundtrip, st cannot be invalid below.
*/
SystemTimeToAprExpTime(result, &st);
result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC);
@@ -155,6 +157,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
* because FileTimeToLocalFileFime is documented that the
* resulting time local file time would have DST relative
* to the *present* date, not the date converted.
+ * The time value makes a roundtrip, localst cannot be invalid below.
*/
SystemTimeToTzSpecificLocalTime(tz, &st, &localst);
SystemTimeToAprExpTime(result, &localst);
@@ -184,6 +187,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
TIME_ZONE_INFORMATION tz;
/* XXX: This code is simply *wrong*. The time converted will always
* map to the *now current* status of daylight savings time.
+ * The time value makes a roundtrip, st cannot be invalid below.
*/
FileTimeToLocalFileTime(&ft, &localft);
@@ -292,6 +296,9 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
/* The Platform SDK documents that SYSTEMTIME/FILETIME are
* generally UTC, so no timezone info needed
*/
+ if (tm->wMonth < 1 || tm->wMonth > 12)
+ return APR_EBADDATE;
+
SystemTimeToAprExpTime(aprtime, *ostime);
return APR_SUCCESS;
}