From 885e4429bf0d935bc28788a9e5aa80585f20ca5f Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 9 Nov 2013 09:22:58 +0100 Subject: [PATCH] gdbusconnection: Fix invalid memory access Occurs when the string is zero length. https://bugzilla.gnome.org/show_bug.cgi?id=711804 --- gio/gdbusconnection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c index 5007f98b0..10cb57a22 100644 --- a/gio/gdbusconnection.c +++ b/gio/gdbusconnection.c @@ -3792,10 +3792,10 @@ path_rule_matches (const gchar *path_a, len_a = strlen (path_a); len_b = strlen (path_b); - if (len_a < len_b && path_a[len_a - 1] != '/') + if (len_a < len_b && (len_a == 0 || path_a[len_a - 1] != '/')) return FALSE; - if (len_b < len_a && path_b[len_b - 1] != '/') + if (len_b < len_a && (len_b == 0 || path_b[len_b - 1] != '/')) return FALSE; return memcmp (path_a, path_b, MIN (len_a, len_b)) == 0;