From 7e69ac4d939b59f3fc32a63620a558fd59dd48ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Mon, 15 Mar 2021 15:31:04 +0200 Subject: color-spec: fix dereference before null check defect Coverity CID: #1445665 --- libmetacity/meta-color-spec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libmetacity/meta-color-spec.c') 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"), -- cgit v1.2.1