Skip to content

RegionMap::isNameChar safeguard broken #2434

@msmuenchen

Description

@msmuenchen

In RegionMap.cpp the safeguard for valid names is broken. The intention is obviously to restrict and normalize region names, however:

  1. the intention is to exclude "most punctuation", however the blanket passthrough c >= 'A' allows for a lot of punctuation, eg. brackets, braces, tilde and pipe signs
  2. it's unclear which encoding is used - theoretically, in the firmware implementation all sorts of Unicode multibytes can be used as the usable first plane is covered by the blanket passthrough and so are followup bytes in multibyte planes, they all are >0x80. Third-party implementations however can assume ascii (like pyMC does) or the full UTF-8 charset including any and all punctuation and ANSI control codes (like meshcore-decoder from analyzer.letsmesh.net).
  3. there is no length restriction obvious from the code. The type definition specifies 31 bytes, however from the implementation it is implied to be a 0-terminated string by the use of strncpy, leaving 30 bytes of "usable" payload. Again, third party implementations differ here, meshcore-decoder does no length assertions at all and pyMC allows for 64 characters. Also, the question remains open if a region name without a leading prefix can be 30 bytes + 1 byte termination long, or if it can be 29 bytes long only because it will get "implied" to have a hashbang as first character.

This should be documented and synchronized amongst known popular implementations as soon as possible, before diverging implementations lead to issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions