forked from pool/openssl-1_1
cdb3e58e2b
- Use upstream-approved patch for the handling of strerror_r * https://github.com/openssl/openssl/pull/8371 - add openssl-fix-handling-of-GNU-strerror_r.patch - drop strerror.patch - Update to 1.1.1b * Added SCA hardening for modular field inversion in EC_GROUP through a new dedicated field_inv() pointer in EC_METHOD. * Change the info callback signals for the start and end of a post-handshake message exchange in TLSv1.3. In 1.1.1/1.1.1a we used SSL_CB_HANDSHAKE_START and SSL_CB_HANDSHAKE_DONE. Experience has shown that many applications get confused by this and assume that a TLSv1.2 renegotiation has started. This can break KeyUpdate handling. Instead we no longer signal the start and end of a post handshake message exchange (although the messages themselves are still signalled). This could break some applications that were expecting the old signals. However without this KeyUpdate is not usable for many applications. * Fix a bug in the computation of the endpoint-pair shared secret used by DTLS over SCTP. This breaks interoperability with older versions of OpenSSL like OpenSSL 1.1.0 and OpenSSL 1.0.2. There is a runtime switch SSL_MODE_DTLS_SCTP_LABEL_LENGTH_BUG (off by default) enabling interoperability with such broken implementations. However, enabling this switch breaks interoperability with correct implementations. * Fix a use after free bug in d2i_X509_PUBKEY when overwriting a re-used X509_PUBKEY object if the second PUBKEY is malformed. * Move strictness check from EVP_PKEY_asn1_new() to EVP_PKEY_asn1_add0() OBS-URL: https://build.opensuse.org/request/show/680495 OBS-URL: https://build.opensuse.org/package/show/security:tls/openssl-1_1?expand=0&rev=30
51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
diff --git a/crypto/o_str.c b/crypto/o_str.c
|
|
index 02578dbf0d..3b271e745b 100644
|
|
--- a/crypto/o_str.c
|
|
+++ b/crypto/o_str.c
|
|
@@ -223,7 +223,26 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
|
#if defined(_MSC_VER) && _MSC_VER>=1400
|
|
return !strerror_s(buf, buflen, errnum);
|
|
#elif defined(_GNU_SOURCE)
|
|
- return strerror_r(errnum, buf, buflen) != NULL;
|
|
+ char *err;
|
|
+
|
|
+ /*
|
|
+ * GNU strerror_r may not actually set buf.
|
|
+ * It can return a pointer to some (immutable) static string in which case
|
|
+ * buf is left unused.
|
|
+ */
|
|
+ err = strerror_r(errnum, buf, buflen);
|
|
+ if (err == NULL)
|
|
+ return 0;
|
|
+ /*
|
|
+ * If err is statically allocated, err != buf and we need to copy the data.
|
|
+ * If err points somewhere inside buf, OPENSSL_strlcpy can handle this,
|
|
+ * since src and dest are not annotated with __restrict and the function
|
|
+ * reads src byte for byte and writes to dest.
|
|
+ * If err == buf we do not have to copy anything.
|
|
+ */
|
|
+ if (err != buf)
|
|
+ OPENSSL_strlcpy(buf, err, buflen);
|
|
+ return 1;
|
|
#elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
|
|
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600)
|
|
/*
|
|
@@ -234,6 +253,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
|
return !strerror_r(errnum, buf, buflen);
|
|
#else
|
|
char *err;
|
|
+
|
|
/* Fall back to non-thread safe strerror()...its all we can do */
|
|
if (buflen < 2)
|
|
return 0;
|
|
@@ -241,8 +261,7 @@ int openssl_strerror_r(int errnum, char *buf, size_t buflen)
|
|
/* Can this ever happen? */
|
|
if (err == NULL)
|
|
return 0;
|
|
- strncpy(buf, err, buflen - 1);
|
|
- buf[buflen - 1] = '\0';
|
|
+ OPENSSL_strlcpy(buf, err, buflen);
|
|
return 1;
|
|
#endif
|
|
}
|