QUIC LCIDM: Minor fixes
authorHugo Landau <hlandau@openssl.org>
Thu, 9 Nov 2023 11:11:17 +0000 (11:11 +0000)
committerHugo Landau <hlandau@openssl.org>
Wed, 6 Dec 2023 10:40:11 +0000 (10:40 +0000)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22673)

ssl/quic/quic_lcidm.c
test/quic_lcidm_test.c

index a79eab878153c48a0754064a2fb3ea5cb7c84fe7..0766f4aaf6ef19ccdb03a647fb8576cfb92677a3 100644 (file)
@@ -149,6 +149,9 @@ static QUIC_LCID *lcidm_get_lcid(const QUIC_LCIDM *lcidm, const QUIC_CONN_ID *lc
 
     key.cid = *lcid;
 
+    if (key.cid.id_len > QUIC_MAX_CONN_ID_LEN)
+        return NULL;
+
     return lh_QUIC_LCID_retrieve(lcidm->lcids, &key);
 }
 
@@ -208,6 +211,9 @@ static QUIC_LCID *lcidm_conn_new_lcid(QUIC_LCIDM *lcidm, QUIC_LCIDM_CONN *conn,
 {
     QUIC_LCID *lcid_obj;
 
+    if (lcid->id_len > QUIC_MAX_CONN_ID_LEN)
+        return NULL;
+
     if ((lcid_obj = OPENSSL_zalloc(sizeof(*lcid_obj))) == NULL)
         return NULL;
 
index 31f6bda4331108f47410fbaa602f4be794f2067a..b5937dfdbffe5ba3bd5221a711fe02af4d3d871e 100644 (file)
@@ -23,7 +23,7 @@ static int test_lcidm(void)
     int testresult = 0;
     QUIC_LCIDM *lcidm;
     size_t lcid_len = 10; /* != ODCID len */
-    QUIC_CONN_ID lcid_1, lcid_dummy, lcid_init;
+    QUIC_CONN_ID lcid_1, lcid_dummy, lcid_init = {0};
     OSSL_QUIC_FRAME_NEW_CONN_ID ncid_frame_1, ncid_frame_2, ncid_frame_3;
     void *opaque = NULL;
     uint64_t seq_num = UINT64_MAX;