From: Igor Ustinov Date: Tue, 31 Mar 2026 14:35:49 +0000 (+0200) Subject: Setting statem.error_state more carefully X-Git-Tag: openssl-4.0.0~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e435518a4f6f45fc8e060f3b7f13fa7d2755becb;p=thirdparty%2Fopenssl.git Setting statem.error_state more carefully Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz MergeDate: Sat Apr 11 19:34:25 2026 (Merged from https://github.com/openssl/openssl/pull/30647) --- diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index b3de7a0982e..549bd7d1259 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -2271,14 +2271,13 @@ static void ssl_update_error_state(SSL_CONNECTION *sc) if (sc == NULL) return; - if (sc->statem.state == MSG_FLOW_ERROR) { + if (sc->statem.state == MSG_FLOW_ERROR + && sc->statem.error_state == ERROR_STATE_NOERROR) { l = ERR_peek_error(); - if (l != 0) { - if (ERR_GET_LIB(l) == ERR_LIB_SYS) - sc->statem.error_state = ERROR_STATE_SYSCALL; - else - sc->statem.error_state = ERROR_STATE_SSL; - } + if (l == 0 || ERR_GET_LIB(l) == ERR_LIB_SYS) + sc->statem.error_state = ERROR_STATE_SYSCALL; + else + sc->statem.error_state = ERROR_STATE_SSL; } }