You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

  1. SECURITY: CVE-2021-35940 (cve.mitre.org)
  2. Restore fix for CVE-2017-12613 which was missing in 1.7.x branch, though
  3. was addressed in 1.6.x in 1.6.3 and later via r1807976.
  4. The fix was merged back to 1.7.x in r1891198.
  5. Since this was a regression in 1.7.0, a new CVE name has been assigned
  6. to track this, CVE-2021-35940.
  7. Thanks to Iveta Cesalova <icesalov redhat.com> for reporting this issue.
  8. https://svn.apache.org/viewvc?view=revision&revision=1891198
  9. --- a/time/unix/time.c
  10. +++ b/time/unix/time.c
  11. @@ -142,6 +142,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_g
  12. static const int dayoffset[12] =
  13. {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
  14. + if (xt->tm_mon < 0 || xt->tm_mon >= 12)
  15. + return APR_EBADDATE;
  16. +
  17. /* shift new year to 1st March in order to make leap year calc easy */
  18. if (xt->tm_mon < 2)
  19. --- a/time/win32/time.c
  20. +++ b/time/win32/time.c
  21. @@ -54,6 +54,9 @@ static void SystemTimeToAprExpTime(apr_t
  22. static const int dayoffset[12] =
  23. {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
  24. + if (tm->wMonth < 1 || tm->wMonth > 12)
  25. + return APR_EBADDATE;
  26. +
  27. /* Note; the caller is responsible for filling in detailed tm_usec,
  28. * tm_gmtoff and tm_isdst data when applicable.
  29. */
  30. @@ -228,6 +231,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_g
  31. static const int dayoffset[12] =
  32. {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
  33. + if (xt->tm_mon < 0 || xt->tm_mon >= 12)
  34. + return APR_EBADDATE;
  35. +
  36. /* shift new year to 1st March in order to make leap year calc easy */
  37. if (xt->tm_mon < 2)