[gupnp] service: Fix check of callback for v6 link-local



commit d7d1cb082fd69565c76dc7e5eaeb9a08832ebf6b
Author: Jens Georg <mail jensge org>
Date:   Wed Jul 29 22:34:40 2020 +0200

    service: Fix check of callback for v6 link-local

 libgupnp/gupnp-service.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index a6e7532..b061c34 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -1193,7 +1193,8 @@ add_subscription_callback (GUPnPContext *context,
                            const char *callback)
 {
             SoupURI *local_uri = NULL;
-            const char *host = NULL;
+            char *host = NULL;
+            char *index = NULL;
 
             local_uri = gupnp_context_rewrite_uri_to_uri (context, callback);
             if (local_uri == NULL) {
@@ -1201,14 +1202,20 @@ add_subscription_callback (GUPnPContext *context,
             }
 
 
-            host = soup_uri_get_host (local_uri);
+            host = g_strdup (soup_uri_get_host (local_uri));
+            index = g_strrstr(host, "%");
+            // Cut off network index
+            if (index != NULL) {
+                    *index = '\0';
+            }
             // CVE-2020-12695: Ignore subscription call-backs that are not "in
             // our network segment"
             if (gupnp_context_ip_is_ours (context, host)) {
-                    return g_list_append (list, local_uri);
+                    list = g_list_append (list, local_uri);
             } else {
                     g_warning ("%s is not in our network; ignoring", callback);
             }
+            g_free (host);
 
             return list;
 }


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