Fix and deduplicate safe isspace checks

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Trivial - P5
    • 1.16.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      CDRIVER-2894 introduced three occurrences of the logic for calling isspace after checking the bounds of the argument, like:

      c >= -1 && c <= 255 && isspace (c)
      

      There are checks in libbson, once in libmongoc, and once in the common library. We should probably refactor this into one function, perhaps named isspace_safe either in bson-string.h or somewhere in common library.

      Additionally, the check in common-b64.c checks with an unsigned char, making the comparison of -1 redundant and triggering an autological warning.

              Assignee:
              Kevin Albertson
              Reporter:
              Kevin Albertson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: