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

Fix and deduplicate safe isspace checks

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 1.16.1
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: