From: Hugo Landau Date: Thu, 17 Nov 2022 14:22:36 +0000 (+0000) Subject: QUIC RX: Fix QRX packet handling refactor w.r.t. list refactor X-Git-Tag: openssl-3.2.0-alpha1~1525 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=043a41ddee;p=thirdparty%2Fopenssl.git QUIC RX: Fix QRX packet handling refactor w.r.t. list refactor Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/19703) --- diff --git a/ssl/quic/quic_record_rx.c b/ssl/quic/quic_record_rx.c index eb975901ed8..69a58483a45 100644 --- a/ssl/quic/quic_record_rx.c +++ b/ssl/quic/quic_record_rx.c @@ -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)