Add an error to the stack on failure in dtls1_write_bytes()
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)
diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h
index a2d6862..8eb3c53 100644
--- a/include/openssl/ssl.h
+++ b/include/openssl/ssl.h
@@ -2259,6 +2259,7 @@
# define SSL_F_DTLS1_READ_FAILED 339
# define SSL_F_DTLS1_RETRANSMIT_MESSAGE 390
# define SSL_F_DTLS1_WRITE_APP_DATA_BYTES 268
+# define SSL_F_DTLS1_WRITE_BYTES 545
# define SSL_F_DTLSV1_LISTEN 350
# define SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC 371
# define SSL_F_DTLS_CONSTRUCT_HELLO_VERIFY_REQUEST 385
diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c
index 9f80050..83f4094 100644
--- a/ssl/record/rec_layer_d1.c
+++ b/ssl/record/rec_layer_d1.c
@@ -732,8 +732,10 @@
{
int i;
- if (!ossl_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH))
+ if (!ossl_assert(len <= SSL3_RT_MAX_PLAIN_LENGTH)) {
+ SSLerr(SSL_F_DTLS1_WRITE_BYTES, ERR_R_INTERNAL_ERROR);
return -1;
+ }
s->rwstate = SSL_NOTHING;
i = do_dtls1_write(s, type, buf, len, 0, written);
return i;
diff --git a/ssl/ssl_err.c b/ssl/ssl_err.c
index f7de9f6..e334b00 100644
--- a/ssl/ssl_err.c
+++ b/ssl/ssl_err.c
@@ -46,6 +46,7 @@
{ERR_FUNC(SSL_F_DTLS1_RETRANSMIT_MESSAGE), "dtls1_retransmit_message"},
{ERR_FUNC(SSL_F_DTLS1_WRITE_APP_DATA_BYTES),
"dtls1_write_app_data_bytes"},
+ {ERR_FUNC(SSL_F_DTLS1_WRITE_BYTES), "dtls1_write_bytes"},
{ERR_FUNC(SSL_F_DTLSV1_LISTEN), "DTLSv1_listen"},
{ERR_FUNC(SSL_F_DTLS_CONSTRUCT_CHANGE_CIPHER_SPEC),
"dtls_construct_change_cipher_spec"},