Check for zero records and return immediately
authorJon Spillett <jon.spillett@oracle.com>
Thu, 2 Mar 2017 02:54:06 +0000 (12:54 +1000)
committerRich Salz <rsalz@openssl.org>
Thu, 2 Mar 2017 14:38:39 +0000 (09:38 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2822)
(cherry picked from commit a3004c820370b6bee82c919721fb1cbe95f72f3f)

ssl/record/ssl3_record.c

index 03c5294046837acb394faf4c4aee055800f27655..5da44e5efbb2a1f0a85dcb8cd68c628191f17d68 100644 (file)
@@ -661,6 +661,9 @@ int tls1_enc(SSL *s, SSL3_RECORD *recs, unsigned int n_recs, int send)
     const EVP_CIPHER *enc;
     unsigned int ctr;
 
+    if (n_recs == 0)
+        return 0;
+
     if (send) {
         if (EVP_MD_CTX_md(s->write_hash)) {
             int n = EVP_MD_CTX_size(s->write_hash);