]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
QUIC RX: Fix QRX packet handling refactor w.r.t. list refactor
authorHugo Landau <hlandau@openssl.org>
Thu, 17 Nov 2022 14:22:36 +0000 (14:22 +0000)
committerHugo Landau <hlandau@openssl.org>
Fri, 13 Jan 2023 13:20:10 +0000 (13:20 +0000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19703)

ssl/quic/quic_record_rx.c

index eb975901ed870fd0cd39af62b83672e4972ccc35..69a58483a458bb348a53b43c95ef8b59435ba1d7 100644 (file)
@@ -41,8 +41,8 @@ static ossl_inline int pkt_is_marked(const uint64_t *bitf, size_t pkt_idx)
 typedef struct rxe_st RXE;
 
 struct rxe_st {
-    OSSL_LIST_MEMBER(rxe, RXE);
     OSSL_QRX_PKT        pkt;
+    OSSL_LIST_MEMBER(rxe, RXE);
     size_t              data_len, alloc_len, refcount;
 
     /* Extra fields for per-packet information. */
@@ -381,12 +381,13 @@ static RXE *qrx_resize_rxe(RXE_LIST *rxl, RXE *rxe, size_t n)
      * data.
      */
     rxe2 = OPENSSL_realloc(rxe, sizeof(RXE) + n);
-    if (rxe2 == NULL || rxe == rxe2) {
+    if (rxe2 == NULL) {
+        /* Resize failed, restore old allocation. */
         if (p == NULL)
             ossl_list_rxe_insert_head(rxl, rxe);
         else
             ossl_list_rxe_insert_after(rxl, p, rxe);
-        return rxe2;
+        return NULL;
     }
 
     if (p == NULL)