]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix reallocation failure condition in qtx_resize_txe()
authorNiels Dossche <niels.dossche@ugent.be>
Thu, 21 Aug 2025 11:24:01 +0000 (13:24 +0200)
committerNeil Horman <nhorman@openssl.org>
Fri, 22 Aug 2025 13:26:05 +0000 (09:26 -0400)
Returning the same pointer does not mean that the reallocation failed,
it would also prevent updating alloc_len down below.
This is similar code and a similar change to 043a41ddee.

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28317)

(cherry picked from commit 220f5be6908631759d56c7a6458be8385d984260)

ssl/quic/quic_record_tx.c

index ef93a14f94a83ae0e01ae1f4e19a86ce200ad049..ae37353a9b26cf9f2d9ce8f4dc4af60d8949c563 100644 (file)
@@ -279,12 +279,12 @@ static TXE *qtx_resize_txe(OSSL_QTX *qtx, TXE_LIST *txl, TXE *txe, size_t n)
      * data.
      */
     txe2 = OPENSSL_realloc(txe, sizeof(TXE) + n);
-    if (txe2 == NULL || txe == txe2) {
+    if (txe2 == NULL) {
         if (p == NULL)
             ossl_list_txe_insert_head(txl, txe);
         else
             ossl_list_txe_insert_after(txl, p, txe);
-        return txe2;
+        return NULL;
     }
 
     if (p == NULL)