Mark a HelloRequest record as read if we ignore it
authorMatt Caswell <matt@openssl.org>
Mon, 9 Jan 2017 17:29:44 +0000 (17:29 +0000)
committerMatt Caswell <matt@openssl.org>
Tue, 10 Jan 2017 12:30:15 +0000 (12:30 +0000)
Otherwise the client will try to process it again. The second time around
it will try and move the record data into handshake fragment storage and
realise that there is no data left. At that point it marks it as read
anyway. However, it is a bug that we go around the loop a second time, so
we prevent that.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2200)

ssl/record/rec_layer_s3.c

index 93b7d05b8d93580c550c6cd216e78d133d080354..486da643d92ee90972633dcf4d9ee66098ce9201 100644 (file)
@@ -1430,7 +1430,12 @@ int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
                         return -1;
                     }
                 }
+            } else {
+                SSL3_RECORD_set_read(rr);
             }
+        } else {
+            /* Does this ever happen? */
+            SSL3_RECORD_set_read(rr);
         }
         /*
          * we either finished a handshake or ignored the request, now try