summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2021-03-15 15:31:04 +0200
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2021-03-15 15:31:04 +0200
commit7e69ac4d939b59f3fc32a63620a558fd59dd48ed (patch)
tree16daab88c863eca9462ed102cda85bc834d16a4e
parentadfedd1d6513ec7fe44c5cf773b6ca89932935ac (diff)
downloadmetacity-7e69ac4d939b59f3fc32a63620a558fd59dd48ed.tar.gz
color-spec: fix dereference before null check defect
Coverity CID: #1445665
-rw-r--r--libmetacity/meta-color-spec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libmetacity/meta-color-spec.c b/libmetacity/meta-color-spec.c
index 173e5163..0029b9fd 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"),