[metacity] color-spec: fix dereference before null check defect



commit 7e69ac4d939b59f3fc32a63620a558fd59dd48ed
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Mar 15 15:31:04 2021 +0200

    color-spec: fix dereference before null check defect
    
    Coverity CID: #1445665

 libmetacity/meta-color-spec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/libmetacity/meta-color-spec.c b/libmetacity/meta-color-spec.c
index 173e51635..0029b9fdf 100644
--- a/libmetacity/meta-color-spec.c
+++ b/libmetacity/meta-color-spec.c
@@ -263,11 +263,15 @@ meta_color_spec_new_from_string (const gchar  *str,
             }
           fallback_str_start++;
         }
-      fallback_str_start++;
+
+      if (*fallback_str_start != '\0')
+        fallback_str_start++;
 
       end = strrchr (str, ')');
 
-      if (color_name_start == NULL || fallback_str_start == NULL || end == NULL)
+      if (*color_name_start == '\0' ||
+          *fallback_str_start == '\0' ||
+          end == NULL)
         {
           g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
                        _("Gtk:custom format is 'gtk:custom(color_name,fallback)', '%s' does not fit the 
format"),


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