[gnome-session/wip/fix-autostart-critical: 1/2] gsm-util: avoid groups in regexex



commit 97eb63ffbe211218388fb705979c898b78ea609d
Author: Ray Strode <rstrode redhat com>
Date:   Tue Mar 26 11:03:00 2019 -0400

    gsm-util: avoid groups in regexex
    
    They can lead to stack overflows if pcre isn't built with --disable-stack-for-recursion

 gnome-session/gsm-util.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index acb446a3..be971fe1 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -517,7 +517,7 @@ gsm_util_export_activation_environment (GError     **error)
                 return FALSE;
         }
 
-        value_regex = g_regex_new ("^([[:blank:]]|[^[:cntrl:]])*$", G_REGEX_OPTIMIZE, 0, error);
+        value_regex = g_regex_new ("^[[:blank:][:^cntrl:]]*$", G_REGEX_OPTIMIZE, 0, error);
 
         if (value_regex == NULL) {
                 return FALSE;
@@ -590,7 +590,7 @@ gsm_util_export_user_environment (GError     **error)
                 return FALSE;
         }
 
-        regex = g_regex_new ("^[a-zA-Z_][a-zA-Z0-9_]*=([[:blank:]]|[^[:cntrl:]])*$", G_REGEX_OPTIMIZE, 0, 
error);
+        regex = g_regex_new ("^[a-zA-Z_][a-zA-Z0-9_]*=[[:blank:][[:^cntrl:]]*$", G_REGEX_OPTIMIZE, 0, error);
 
         if (regex == NULL) {
                 return FALSE;


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