git: fbdf5e82a0af - stable/12 - apr: Merge r1889604, r1807975 from trunk:
Ed Maste
emaste at FreeBSD.org
Wed Sep 15 02:03:30 UTC 2021
The branch stable/12 has been updated by emaste:
URL: https://cgit.FreeBSD.org/src/commit/?id=fbdf5e82a0afc98e14ebb58f4cc8c1c0655b1316
commit fbdf5e82a0afc98e14ebb58f4cc8c1c0655b1316
Author: Joe Orton <jorton at apache.org>
AuthorDate: 2021-07-02 11:10:33 +0000
Commit: Ed Maste <emaste at FreeBSD.org>
CommitDate: 2021-09-15 01:42:23 +0000
apr: 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
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.7.x@1891198 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit fc1b69d0311e50ed05c00c46ad7dd5d560e57cb6)
---
contrib/apr/random/unix/sha2.c | 4 ++--
contrib/apr/time/unix/time.c | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/contrib/apr/random/unix/sha2.c b/contrib/apr/random/unix/sha2.c
index 12c257d1fa1b..8059a9d78a71 100644
--- a/contrib/apr/random/unix/sha2.c
+++ b/contrib/apr/random/unix/sha2.c
@@ -425,7 +425,7 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len)
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[], SHA256_CTX* context) {
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;
diff --git a/contrib/apr/time/unix/time.c b/contrib/apr/time/unix/time.c
index dfa45e690c62..7f0958192769 100644
--- a/contrib/apr/time/unix/time.c
+++ b/contrib/apr/time/unix/time.c
@@ -142,6 +142,9 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt)
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)
More information about the dev-commits-src-all
mailing list