Summary: | [PATCH] Fix is_valid_section_name always returning true | ||
---|---|---|---|
Product: | dbus | Reporter: | Albert Astals Cid <aacid> |
Component: | core | Assignee: | D-Bus Maintainers <dbus> |
Status: | RESOLVED MOVED | QA Contact: | D-Bus Maintainers <dbus> |
Severity: | normal | ||
Priority: | medium | CC: | amigadave |
Version: | git master | Keywords: | patch |
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | review- | ||
i915 platform: | i915 features: | ||
Attachments: | The said patch |
Description
Albert Astals Cid
2018-04-23 07:08:17 UTC
Comment on attachment 138992 [details] [review] The said patch Review of attachment 138992 [details] [review]: ----------------------------------------------------------------- This patch looks good to me, but it would be better to include some new unit tests to ensure this doesn’t regress (and that other bugs aren’t present). Yes, it would be better to have an autotest, but i don't really have time to write it. BTW i was thinking on how this can cause regressions when stuff that was previously "working" now is "correctly" rejected. Maybe the other option is just remove this if, since the code has been broken since 2003 and noone seems to have noticed yet. Comment on attachment 138992 [details] [review] The said patch Review of attachment 138992 [details] [review]: ----------------------------------------------------------------- ::: bus/desktop-file.c @@ +386,1 @@ > *name == '\n' || *name == '\t')) The observant will notice that after it has been corrected, this condition does not allow the only section name that we ever use in practice, which is "D-BUS Service" (which spells D-Bus with an incorrect case combination for historical reasons), because that section name contains a dash and a space. Sure enough, when this patch is applied, the unit tests fail. There is also a comment: + /* 5. Group names may contain all ASCII characters except for control characters and '[' and ']'. */ which flatly contradicts the actual implementation (which appears to have been intended to accept A-Z, a-z, tab (?!) and newline (!) in these one-line section headings. This function had one job... :-( And, yes, this has been wrong since 2003. I think we should probably be applying what the comment says, instead. That would mean we reject 0x00 to 0x1F (control characters), accept 0x20 to 0x7E (printable ASCII including space), and reject 0x7F (backspace) and 0x80 and up (non-ASCII). If we change this then we should absolutely have (at least minimal) test coverage for it. (In reply to Simon McVittie from comment #3) > would mean we reject 0x00 to 0x1F (control characters), accept 0x20 to 0x7E > (printable ASCII including space) ... except for '[' and ']'. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/dbus/dbus/issues/208. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.