Sha256: 7ec0fd5095145f0fa643aeba9885f3b72a43c9b67a50e0840dd004b238cd0011

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

#include <stdlib.h>
#include <stdio.h>
#include "kms_message/kms_message.h"
#include "kms_message_private.h"
#include <src/kms_message/kms_b64.h>
#include <src/hexlify.h>
#include <src/kms_request_str.h>
#include <src/kms_kv_list.h>
#include <src/kms_port.h>

/* Fuzzer for targeted the kms_response_parser_feed and
 * kms_request_new functions.
 */
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
    kms_response_parser_t *parser = NULL;
    parser = kms_response_parser_new();
    if (parser != NULL) {
        kms_response_parser_feed(parser,data, size);
        kms_response_parser_destroy(parser);
    }

    if (size > 50) {
        /* Create two null-terminated strings */
        char *method = malloc(25);
        memcpy(method, data, 24);
        method[24] = '\0';
        data += 24; size -= 24;

        char *uri_path = malloc(25);
        memcpy(uri_path, data, 24);
        uri_path[24] = '\0';

        kms_request_t *request = NULL;
        request = kms_request_new (method, uri_path, NULL);
        if (request != NULL) {
            kms_request_destroy(request);
        }
        free(method);
        free(uri_path);
    }
    return 0;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
libmongocrypt-helper-1.7.4.0.1002 ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c
libmongocrypt-helper-1.7.4.0.1001 ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c
libmongocrypt-helper-1.7.4.0.1000 ext/libmongocrypt/libmongocrypt/test/fuzz_kms.c