]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl-quic: handle error in SSL_get_stream_read_error_code
authorStefan Eissing <stefan@eissing.org>
Thu, 25 Sep 2025 10:38:02 +0000 (12:38 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 25 Sep 2025 12:11:25 +0000 (14:11 +0200)
The return code of SSL_get_stream_read_error_code() was not checked
in one location, but others. Make that consistent.

Reported in Joshua's sarif data

Closes #18725

lib/vquic/curl_osslq.c

index b4cc052ec243095ceaf72bfa676a66cf8d003949..e6278ad961a95b137d085f10047a1e95933d870a 100644 (file)
@@ -1264,12 +1264,16 @@ static CURLcode h3_quic_recv(void *reader_ctx,
     else if(SSL_get_stream_read_state(x->s->ssl) ==
             SSL_STREAM_STATE_RESET_REMOTE) {
       uint64_t app_error_code = NGHTTP3_H3_NO_ERROR;
-      SSL_get_stream_read_error_code(x->s->ssl, &app_error_code);
-      CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRId64 "] h3_quic_recv -> RESET, "
-                  "rv=%d, app_err=%" FMT_PRIu64,
-                  x->s->id, rv, (curl_uint64_t)app_error_code);
-      if(app_error_code != NGHTTP3_H3_NO_ERROR) {
+      if(!SSL_get_stream_read_error_code(x->s->ssl, &app_error_code)) {
         x->s->reset = TRUE;
+        return CURLE_RECV_ERROR;
+      }
+      else {
+        CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRId64 "] h3_quic_recv -> RESET, "
+                    "rv=%d, app_err=%" FMT_PRIu64,
+                    x->s->id, rv, (curl_uint64_t)app_error_code);
+        if(app_error_code != NGHTTP3_H3_NO_ERROR)
+          x->s->reset = TRUE;
       }
       x->s->recvd_eos = TRUE;
       return CURLE_OK;