diff options
Diffstat (limited to 'bus/desktop-file.c')
-rw-r--r-- | bus/desktop-file.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bus/desktop-file.c b/bus/desktop-file.c index 44598584..fd4f0d31 100644 --- a/bus/desktop-file.c +++ b/bus/desktop-file.c @@ -378,12 +378,16 @@ parse_comment_or_blank (BusDesktopFileParser *parser) static dbus_bool_t is_valid_section_name (const char *name) { - /* 5. Group names may contain all ASCII characters except for control characters and '[' and ']'. */ + /* 5. Group names may contain all ASCII characters except for control characters and '[' and ']'. + * + * We don't use isprint() here because it's locale-dependent. ASCII + * characters <= 0x1f and 0x7f are control characters, and bytes with + * values >= 0x80 aren't ASCII. 0x20 is a space, which we must allow, + * not least because DBUS_SERVICE_SECTION contains one. */ 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++; |