[gvfs/gnome-3-30] common: Prevent crashes on invalid autorun file



commit c5fd1efd4575ba352476c95027bcf54b00aa4e28
Author: Ondrej Holy <oholy redhat com>
Date:   Fri Oct 26 14:45:43 2018 +0200

    common: Prevent crashes on invalid autorun file
    
    GRegex expects valid UTF-8 input by default and libpcre may crash if
    it is not valid. GRegex is used to parse autorun file, which doesn't
    have to be always valid. Let's use G_REGEX_RAW to prevent the crashes.
    
    Closes: https://gitlab.gnome.org/GNOME/gvfs/issues/344

 common/gvfsmountinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/common/gvfsmountinfo.c b/common/gvfsmountinfo.c
index 3b191892..c3f31afd 100644
--- a/common/gvfsmountinfo.c
+++ b/common/gvfsmountinfo.c
@@ -107,7 +107,7 @@ on_autorun_loaded (GObject      *source_object,
        * has a comma at the end
        **/
       icon_regex = g_regex_new ("icon\\s*=\\s*+([^,\\r\\n]+)",
-                                G_REGEX_CASELESS, 0, NULL);
+                                G_REGEX_CASELESS | G_REGEX_RAW, 0, NULL);
       g_regex_match (icon_regex, content, 0,
                      &match_info);
 


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