openssl+sectrust: move session verified set into result check

Pointed out by Codex Security
Closes #22248
This commit is contained in:
Stefan Eissing 2026-07-02 13:11:35 +02:00 committed by Daniel Stenberg
parent c7f67be010
commit 6ab52f7c89
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2689,10 +2689,10 @@ CURLcode Curl_ossl_add_session(struct Curl_cfilter *cf,
earlydata_max, qtp_clone, quic_tp_len,
&sc_session);
der_session_buf = NULL; /* took ownership of sdata */
#ifdef USE_APPLE_SECTRUST
sc_session->sectrust_verified = octx->sectrust_verified;
#endif
if(!result) {
#ifdef USE_APPLE_SECTRUST
sc_session->sectrust_verified = octx->sectrust_verified;
#endif
result = Curl_ssl_scache_put(cf, data, ssl_peer_key, sc_session);
/* took ownership of `sc_session` */
}