[epiphany/mcatanzaro/hostname-to-tld] web-view: add protective assert



commit 7eb08c85d6c7d16bfa9d3b723ba1672e6e10ea0b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Nov 12 15:35:15 2019 -0600

    web-view: add protective assert
    
    This should never happen, but it's not a bad idea to be paranoid and
    make sure of that. We would have a buffer overflow if length is ever 0
    here (which should not be possible).

 embed/ephy-web-view.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index de394f104..86434df31 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1879,6 +1879,7 @@ hostname_to_tld (const char *hostname)
   parts = g_strsplit (hostname, ".", 0);
   length = g_strv_length (parts);
 
+  g_assert (length >= 1);
   return g_strdup (parts[length - 1]);
 }
 


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