From: David King Date: Fri, 12 Oct 2018 12:58:43 +0000 (+0100) Subject: is_valid_section_name: Fix logical expression X-Git-Tag: dbus-1.12.14~5^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b099429862294cf33f6fdd7b3c77aedfc8308a2;p=platform%2Fupstream%2Fdbus.git is_valid_section_name: Fix logical expression Group names in desktop files may contain all ASCII characters, except control characters and '[' and ']'. Rather than accepting all values, thanks to a logical operator confusion found by GCC warning -Wlogical-op, instead explicitly reject the invalid values. Signed-off-by: David King Fixes: https://gitlab.freedesktop.org/dbus/dbus/issues/208 (cherry picked from commit 3ef9e789c1b99f420078f4debabd4f5c4fa0a748) --- diff --git a/bus/desktop-file.c b/bus/desktop-file.c index 4459858..d91439b 100644 --- a/bus/desktop-file.c +++ b/bus/desktop-file.c @@ -382,8 +382,7 @@ is_valid_section_name (const char *name) while (*name) { - if (!((*name >= 'A' && *name <= 'Z') || (*name >= 'a' || *name <= 'z') || - *name == '\n' || *name == '\t')) + if (*name <= 0x1f || *name >= 0x7f || *name == '[' || *name == ']') return FALSE; name++;