Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2159

Ignore non-ASCII when downcasing domain names

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.11.0
    • Affects Version/s: None
    • Component/s: libmongoc, network
    • Fully Compatible

      SDAM requires us to downcase domain names of MongoDB servers:

      https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#hostnames-are-normalized-to-lower-case

      Our decision was to translate uppercase ASCII chars to lowercase and leave non-ASCII chars unchanged.

      The C Driver uses mongoc_lowercase for this. I'm concerned that a multibyte UTF-8 character could be corrupted by its algorithm:

      void
      mongoc_lowercase (const char *src, char *buf /* OUT */)
      {
         for (; *src; ++src, ++buf) {
            *buf = tolower (*src);
         }
      }
      

      It should probably use bson_utf8_next_char to advance through the string, instead of using "++".

            Assignee:
            Unassigned Unassigned
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: