450916
diff -up openssl-1.0.2k/ssl/d1_pkt.c.padding-oracle openssl-1.0.2k/ssl/d1_pkt.c
450916
--- openssl-1.0.2k/ssl/d1_pkt.c.padding-oracle	2017-01-26 14:22:04.000000000 +0100
450916
+++ openssl-1.0.2k/ssl/d1_pkt.c	2019-04-05 10:39:08.574409987 +0200
450916
@@ -1290,6 +1290,7 @@ int dtls1_read_bytes(SSL *s, int type, u
450916
             ERR_add_error_data(2, "SSL alert number ", tmp);
450916
             s->shutdown |= SSL_RECEIVED_SHUTDOWN;
450916
             SSL_CTX_remove_session(s->session_ctx, s->session);
450916
+            s->state = SSL_ST_ERR;
450916
             return (0);
450916
         } else {
450916
             al = SSL_AD_ILLEGAL_PARAMETER;
450916
diff -up openssl-1.0.2k/ssl/s3_pkt.c.padding-oracle openssl-1.0.2k/ssl/s3_pkt.c
450916
--- openssl-1.0.2k/ssl/s3_pkt.c.padding-oracle	2017-01-26 14:22:04.000000000 +0100
450916
+++ openssl-1.0.2k/ssl/s3_pkt.c	2019-04-05 10:40:35.838894197 +0200
450916
@@ -1495,6 +1495,7 @@ int ssl3_read_bytes(SSL *s, int type, un
450916
             ERR_add_error_data(2, "SSL alert number ", tmp);
450916
             s->shutdown |= SSL_RECEIVED_SHUTDOWN;
450916
             SSL_CTX_remove_session(s->session_ctx, s->session);
450916
+            s->state = SSL_ST_ERR;
450916
             return (0);
450916
         } else {
450916
             al = SSL_AD_ILLEGAL_PARAMETER;
450916
@@ -1714,9 +1715,12 @@ int ssl3_send_alert(SSL *s, int level, i
450916
                                           * protocol_version alerts */
450916
     if (desc < 0)
450916
         return -1;
450916
-    /* If a fatal one, remove from cache */
450916
-    if ((level == 2) && (s->session != NULL))
450916
-        SSL_CTX_remove_session(s->session_ctx, s->session);
450916
+    /* If a fatal one, remove from cache and go into the error state */
450916
+    if (level == SSL3_AL_FATAL) {
450916
+        if (s->session != NULL)
450916
+            SSL_CTX_remove_session(s->session_ctx, s->session);
450916
+        s->state = SSL_ST_ERR;
450916
+    }
450916
 
450916
     s->s3->alert_dispatch = 1;
450916
     s->s3->send_alert[0] = level;