URI parsing does not validate out-of-range port numbers

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • TBD
    • Affects Version/s: 1.1.0
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In our test suite, the base URI in standalone server tests is "mongodb://192.168.112.10:2000". If we improperly concatenate this string and create an invalid port (e.g. 2000999), mongoc_uri_parse_host() still attempts to parse it as an unsigned 16-bit integer:

      sscanf (end_host, "%hu", &port);
      

      The end result is an exception when the driver cannot connect to a server on port 34919. Would it make more sense to attempt to validate the port and return an error during parsing?

              Assignee:
              A. Jesse Jiryu Davis
              Reporter:
              Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: