Add an error to the stack on failure in dtls1_write_bytes()
authorMatt Caswell <matt@openssl.org>
Mon, 22 May 2017 11:36:11 +0000 (12:36 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 22 May 2017 13:00:52 +0000 (14:00 +0100)
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3496)

include/openssl/ssl.h
ssl/record/rec_layer_d1.c
ssl/ssl_err.c

index a2d68628311b14101438c0e4150b89ad0063a092..8eb3c5389f144a7f0331ef5e03df33bc4082aa07 100644 (file)
@@ -2259,6 +2259,7 @@ int ERR_load_SSL_strings(void);
 # 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
index 9f80050f01f181ee8bf6c2b14800221719002a85..83f40943f3ca3773ddb6f88645fab606d627b2ce 100644 (file)
@@ -732,8 +732,10 @@ int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len,
 {
     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;
index f7de9f61d96b986ae6a3f1b1657f813c8c516687..e334b00370fc36714110e57862525ddce649a2a4 100644 (file)
@@ -46,6 +46,7 @@ static ERR_STRING_DATA SSL_str_functs[] = {
     {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"},