Uploaded image for project: 'Libmongocrypt'
  1. Libmongocrypt
  2. MONGOCRYPT-14

Inconsistent about taking string length

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      Some functions take a string length:

      MONGOCRYPT_EXPORT
      bool
      mongocrypt_ctx_setopt_masterkey_aws (mongocrypt_ctx_t *ctx,
                                           const char *region,
                                           uint32_t region_len,
                                           const char *cmk,
                                           uint32_t cmk_len);
      

      This enables drivers to pass non NULL terminated strings. But others don't:

      MONGOCRYPT_EXPORT
      bool
      mongocrypt_setopt_kms_provider_aws (mongocrypt_t *crypt,
                                          const char *aws_access_key_id,
                                          const char *aws_secret_access_key);
      

      As per discussion, let's change these methods so that they take a char*-len pair, but allow the length to be -1 to indicate NULL-terminated strings.  This gives us a better safety guarantee while allowing more flexibility for drivers.

            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: