diff options
author | Matt Caswell <matt@openssl.org> | 2022-10-27 15:38:32 +0100 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-14 10:14:41 +0100 |
commit | 732435026b0141063084fb68c076bc1c9fd9bee8 (patch) | |
tree | 1e9c156533a7f9eafd0ebdb4098286f3acd044f8 /ssl/s3_lib.c | |
parent | 6f3072212c2d56cae598bc1d180b2673b3df9be0 (diff) |
Resolve a TODO in ssl3_dispatch_alert
Properly handle the case where there is pending write data and we want
to send an alert.
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19550)
Diffstat (limited to 'ssl/s3_lib.c')
-rw-r--r-- | ssl/s3_lib.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 0cf7954872..e7078efa6c 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -4443,11 +4443,11 @@ int ssl3_shutdown(SSL *s) ssl3_send_alert(sc, SSL3_AL_WARNING, SSL_AD_CLOSE_NOTIFY); /* * our shutdown alert has been sent now, and if it still needs to be - * written, s->s3.alert_dispatch will be true + * written, s->s3.alert_dispatch will be > 0 */ - if (sc->s3.alert_dispatch) + if (sc->s3.alert_dispatch > 0) return -1; /* return WANT_WRITE */ - } else if (sc->s3.alert_dispatch) { + } else if (sc->s3.alert_dispatch > 0) { /* resend it if not sent */ ret = s->method->ssl_dispatch_alert(s); if (ret == -1) { @@ -4469,8 +4469,8 @@ int ssl3_shutdown(SSL *s) } } - if ((sc->shutdown == (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN)) && - !sc->s3.alert_dispatch) + if ((sc->shutdown == (SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN)) + && sc->s3.alert_dispatch == SSL_ALERT_DISPATCH_NONE) return 1; else return 0; |