You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2021/07/02 11:10:33 UTC
svn commit: r1891198 - in /apr/apr/branches/1.7.x: ./ random/unix/sha2.c
time/unix/time.c time/win32/time.c
Author: jorton
Date: Fri Jul 2 11:10:33 2021
New Revision: 1891198
URL: http://svn.apache.org/viewvc?rev=1891198&view=rev
Log:
Merge r1889604, r1807975 from trunk:
* random/unix/sha2.c (apr__SHA256_Final, apr__SHA256_End): Fix parameter
buffer lengths to match declaration, avoiding GCC 11 warning.
(no functional change)
Bounds-check human-readable date fields (credit: Stefan Sperling)
Submitted by: jorton, niq
Reviewed by: jorton
Modified:
apr/apr/branches/1.7.x/ (props changed)
apr/apr/branches/1.7.x/random/unix/sha2.c
apr/apr/branches/1.7.x/time/unix/time.c
apr/apr/branches/1.7.x/time/win32/time.c
Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1807975,1889604
Modified: apr/apr/branches/1.7.x/random/unix/sha2.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/random/unix/sha2.c?rev=1891198&r1=1891197&r2=1891198&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/random/unix/sha2.c (original)
+++ apr/apr/branches/1.7.x/random/unix/sha2.c Fri Jul 2 11:10:33 2021
@@ -425,7 +425,7 @@ void apr__SHA256_Update(SHA256_CTX* cont
usedspace = freespace = 0;
}
-void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+void apr__SHA256_Final(sha2_byte digest[SHA256_DIGEST_LENGTH], SHA256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
unsigned int usedspace;
@@ -496,7 +496,7 @@ void apr__SHA256_Final(sha2_byte digest[
usedspace = 0;
}
-char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) {
+char *apr__SHA256_End(SHA256_CTX* context, char buffer[SHA256_DIGEST_STRING_LENGTH]) {
sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest;
int i;
Modified: apr/apr/branches/1.7.x/time/unix/time.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/time/unix/time.c?rev=1891198&r1=1891197&r2=1891198&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/time/unix/time.c (original)
+++ apr/apr/branches/1.7.x/time/unix/time.c Fri Jul 2 11:10:33 2021
@@ -142,6 +142,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_g
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)
Modified: apr/apr/branches/1.7.x/time/win32/time.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/time/win32/time.c?rev=1891198&r1=1891197&r2=1891198&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/time/win32/time.c (original)
+++ apr/apr/branches/1.7.x/time/win32/time.c Fri Jul 2 11:10:33 2021
@@ -54,6 +54,9 @@ static void SystemTimeToAprExpTime(apr_t
static const int dayoffset[12] =
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
+ if (tm->wMonth < 1 || tm->wMonth > 12)
+ return APR_EBADDATE;
+
/* Note; the caller is responsible for filling in detailed tm_usec,
* tm_gmtoff and tm_isdst data when applicable.
*/
@@ -228,6 +231,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_g
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
+ if (xt->tm_mon < 0 || xt->tm_mon >= 12)
+ return APR_EBADDATE;
+
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)