summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid King <dking@redhat.com>2018-10-12 13:58:43 +0100
committerSimon McVittie <smcv@collabora.com>2019-04-17 13:38:05 +0100
commit2b099429862294cf33f6fdd7b3c77aedfc8308a2 (patch)
treeb38ad40fe1a3bfae23aafa0375c91b43cce168a7
parent6ef67cff6ba26645f9cbe23ffb401f3d49a66429 (diff)
downloaddbus-2b099429862294cf33f6fdd7b3c77aedfc8308a2.tar.gz
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 <dking@redhat.com> Fixes: https://gitlab.freedesktop.org/dbus/dbus/issues/208 (cherry picked from commit 3ef9e789c1b99f420078f4debabd4f5c4fa0a748)
-rw-r--r--bus/desktop-file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/bus/desktop-file.c b/bus/desktop-file.c
index 44598584..d91439b3 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++;