[vlc-commits] [Git][videolan/vlc][master] 2 commits: misc: securetransport: fix inverted check

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Aug 27 08:45:36 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
653f66f4 by Alexandre Janniaux at 2026-08-27T08:30:16+00:00
misc: securetransport: fix inverted check

Regression from 583c5c241cab0dc4777d5913f2c20f785cfb0973 which changed
a ret != noErr into a similar tls != NULL.

- - - - -
17dabd7e by Alexandre Janniaux at 2026-08-27T08:30:16+00:00
misc: securetransport: return the derived session type

st_SessionOpenCommon() allocates a vlc_tls_st_t but returned the
underlying vlc_tls_t, so call sites had to cast the result.

- - - - -


1 changed file:

- modules/misc/securetransport.c


Changes:

=====================================
modules/misc/securetransport.c
=====================================
@@ -634,9 +634,9 @@ static const struct vlc_tls_operations st_ops =
  * Initializes a client-side TLS session.
  */
 
-static vlc_tls_t *st_SessionOpenCommon(vlc_object_t *obj,
-                                       vlc_tls_creds_sys_t *crd,
-                                       vlc_tls_t *sock, bool b_server)
+static vlc_tls_st_t *st_SessionOpenCommon(vlc_object_t *obj,
+                                          vlc_tls_creds_sys_t *crd,
+                                          vlc_tls_t *sock, bool b_server)
 {
     vlc_tls_st_t *sys = malloc(sizeof (*sys));
     if (unlikely(sys == NULL))
@@ -677,7 +677,7 @@ static vlc_tls_t *st_SessionOpenCommon(vlc_object_t *obj,
         goto error;
     }
 
-    return tls;
+    return sys;
 
 error:
     st_SessionClose(tls);
@@ -689,13 +689,11 @@ static vlc_tls_t *st_ClientSessionOpen(vlc_tls_client_t *crd, vlc_tls_t *sock,
 {
     msg_Dbg(crd, "open TLS session for %s", hostname);
 
-    vlc_tls_t *tls = st_SessionOpenCommon(VLC_OBJECT(crd), crd->sys, sock,
-                                          false);
-    if (tls == NULL)
+    vlc_tls_st_t *sys = st_SessionOpenCommon(VLC_OBJECT(crd), crd->sys, sock,
+                                             false);
+    if (sys == NULL)
         return NULL;
 
-    vlc_tls_st_t *sys = (vlc_tls_st_t *)tls;
-
     OSStatus ret = SSLSetPeerDomainName(sys->p_context, hostname, strlen(hostname));
     if (ret != noErr) {
         msg_Err(crd, "cannot set peer domain name");
@@ -759,11 +757,11 @@ static vlc_tls_t *st_ClientSessionOpen(vlc_tls_client_t *crd, vlc_tls_t *sock,
     }
 #endif
 
-    return tls;
+    return &sys->tls;
 
 error:
-    st_SessionShutdown(tls, true);
-    st_SessionClose(tls);
+    st_SessionShutdown(&sys->tls, true);
+    st_SessionClose(&sys->tls);
     return NULL;
 }
 
@@ -816,12 +814,11 @@ static vlc_tls_t *st_ServerSessionOpen (vlc_tls_server_t *crd, vlc_tls_t *sock,
     VLC_UNUSED(alpn);
     msg_Dbg(crd, "open TLS server session");
 
-    vlc_tls_t *tls = st_SessionOpenCommon(VLC_OBJECT(crd), crd->sys, sock,
-                                          true);
-    if (tls != NULL)
+    vlc_tls_st_t *sys = st_SessionOpenCommon(VLC_OBJECT(crd), crd->sys, sock,
+                                             true);
+    if (sys == NULL)
         return NULL;
 
-    vlc_tls_st_t *sys = (vlc_tls_st_t *)tls;
     vlc_tls_creds_sys_t *p_cred_sys = crd->sys;
 
     OSStatus ret = SSLSetCertificate(sys->p_context, p_cred_sys->server_cert_chain);
@@ -830,11 +827,11 @@ static vlc_tls_t *st_ServerSessionOpen (vlc_tls_server_t *crd, vlc_tls_t *sock,
         goto error;
     }
 
-    return tls;
+    return &sys->tls;
 
 error:
-    st_SessionShutdown(tls, true);
-    st_SessionClose(tls);
+    st_SessionShutdown(&sys->tls, true);
+    st_SessionClose(&sys->tls);
     return NULL;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/54a50fd725c4bc21e002dc3a76e54eb923880764...17dabd7ed47712c1beebd3b99c75d0b993e51ce6

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/54a50fd725c4bc21e002dc3a76e54eb923880764...17dabd7ed47712c1beebd3b99c75d0b993e51ce6
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list