The branch master has been updated via c19e6da9a345b1e14caca23c50a0c7690309e0e4 (commit) from cddbcf0d2887388d95d5b338b249ac3923be00f1 (commit)
- Log ----------------------------------------------------------------- commit c19e6da9a345b1e14caca23c50a0c7690309e0e4 Author: Patrick Steuer <patrick.ste...@de.ibm.com> Date: Tue Aug 11 13:51:04 2020 +0200 Appease -Werror=stringop-overflow= gcc 10 seems to think of assigning to an (unsigned) char array as a stringop and demands additional space for a terminating '\0': In function 'ssl3_generate_key_block', inlined from 'ssl3_setup_key_block' at ssl/s3_enc.c:304:11: ssl/s3_enc.c:51:20: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] 51 | buf[j] = c; | ~~~~~~~^~~ ssl/s3_enc.c: In function 'ssl3_setup_key_block': ssl/s3_enc.c:23:19: note: at offset 16 to object 'buf' with size 16 declared here 23 | unsigned char buf[16], smd[SHA_DIGEST_LENGTH]; | ^~~ Signed-off-by: Patrick Steuer <patrick.ste...@de.ibm.com> Reviewed-by: Tomas Mraz <tm...@fedoraproject.org> Reviewed-by: Paul Dale <paul.d...@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12632) ----------------------------------------------------------------------- Summary of changes: ssl/s3_enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 36b7c7616e..bd668f317e 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -22,7 +22,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num) EVP_MD_CTX *s1; unsigned char buf[16], smd[SHA_DIGEST_LENGTH]; unsigned char c = 'A'; - unsigned int i, j, k; + unsigned int i, k; int ret = 0; #ifdef CHARSET_EBCDIC @@ -47,8 +47,7 @@ static int ssl3_generate_key_block(SSL *s, unsigned char *km, int num) goto err; } - for (j = 0; j < k; j++) - buf[j] = c; + memset(buf, c, k); c++; if (!EVP_DigestInit_ex(s1, sha1, NULL) || !EVP_DigestUpdate(s1, buf, k)