[epiphany] Skip addresses with a space in is_host_with_port()



commit b00ef4c948d68cf0d43b94557e449f0dcb1300e6
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sat Jan 9 13:21:20 2021 +0100

    Skip addresses with a space in is_host_with_port()
    
    Addresses with a space shouldn't be treated as a valid host with port. Just
    exit early.
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1418

 embed/ephy-embed-utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 1dc44ebe2..59c9e05c8 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -218,9 +218,13 @@ is_bang_search (const char *address)
 static gboolean
 is_host_with_port (const char *address)
 {
-  g_auto (GStrv) split = g_strsplit (address, ":", -1);
+  g_auto (GStrv) split = NULL;
   gint64 port = 0;
 
+  if (strchr (address, ' '))
+    return FALSE;
+
+  split = g_strsplit (address, ":", -1);
   if (g_strv_length (split) == 2)
     port = g_ascii_strtoll (split[1], NULL, 10);
 


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