From 849b88fc64b95c86b079bb3218b72ffda279342e Mon Sep 17 00:00:00 2001 From: Hugo Landau Date: Thu, 21 Mar 2024 10:47:21 +0000 Subject: [PATCH] Minor fixes Reviewed-by: Matt Caswell Reviewed-by: Neil Horman (Merged from https://github.com/openssl/openssl/pull/23334) --- include/internal/quic_port.h | 2 +- ssl/quic/quic_obj.c | 2 +- ssl/quic/quic_obj_local.h | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/internal/quic_port.h b/include/internal/quic_port.h index 1f8997a1591..9c74390ab29 100644 --- a/include/internal/quic_port.h +++ b/include/internal/quic_port.h @@ -138,7 +138,7 @@ void ossl_quic_port_subtick(QUIC_PORT *port, QUIC_TICK_RESULT *r, /* Returns the number of queued incoming channels. */ size_t ossl_quic_port_get_num_incoming_channels(const QUIC_PORT *port); -/* Returns 1 if incoming connections should currently be allowed. */ +/* Sets if incoming connections should currently be allowed. */ void ossl_quic_port_set_allow_incoming(QUIC_PORT *port, int allow_incoming); /* Returns 1 if we are using addressed mode on the read side. */ diff --git a/ssl/quic/quic_obj.c b/ssl/quic/quic_obj.c index 8529ad70d74..ffe6b1bcda1 100644 --- a/ssl/quic/quic_obj.c +++ b/ssl/quic/quic_obj.c @@ -23,7 +23,7 @@ int ossl_quic_obj_init(QUIC_OBJ *obj, int is_event_leader = (engine != NULL); int is_port_leader = (port != NULL); - if (!ossl_assert(!obj->init_done && obj != NULL && SSL_TYPE_IS_QUIC(type) + if (!ossl_assert(obj != NULL && !obj->init_done && SSL_TYPE_IS_QUIC(type) && (parent_obj == NULL || IS_QUIC(parent_obj)))) return 0; diff --git a/ssl/quic/quic_obj_local.h b/ssl/quic/quic_obj_local.h index 55daf822151..d0cfa4165b5 100644 --- a/ssl/quic/quic_obj_local.h +++ b/ssl/quic/quic_obj_local.h @@ -148,13 +148,14 @@ SSL_CONNECTION *ossl_quic_obj_get0_handshake_layer(QUIC_OBJ *obj); static ossl_inline ossl_unused SSL * ossl_quic_obj_get0_ssl(QUIC_OBJ *obj) { - assert(obj->init_done); - /* * ->ssl is guaranteed to have an offset of 0 but the NULL check here makes * ubsan happy. */ - return obj != NULL ? &obj->ssl : NULL; + if (!ossl_assert(obj != NULL)) + return NULL; + + return &obj->ssl; } /* -- 2.47.2