[gssdp] client: Prevent crash if not initialized



commit 8d54d97ff5a010acb1d5dbd95080c8085b6b61cd
Author: Jens Georg <mail jensge org>
Date:   Fri Apr 3 11:25:45 2020 +0200

    client: Prevent crash if not initialized
    
    If g_initable_init() was not called on the GSSDPClient instance, this
    will pass on invalid GSockets down to GLib, which might lead to a crash
    
    Fixes #5

 libgssdp/gssdp-client.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index d971467..c4503be 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -1258,6 +1258,8 @@ _gssdp_client_send_message (GSSDPClient      *client,
 
         priv = gssdp_client_get_instance_private (client);
 
+        g_return_if_fail (priv->initialized);
+
         if (!priv->active)
                 /* We don't send messages in passive mode */
                 return;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]