Raw
1 #include "git-compat-util.h"
2 #include <stddef.h>
3 #include <stdlib.h>
4 #include <stdint.h>
5 #include <string.h>
6 #include <stdio.h>
7 #include "credential.h"
8
9 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
10
11 int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
12 {
13 struct credential c;
14 char *buf;
15
16 buf = malloc(size + 1);
17 if (!buf)
18 return 0;
19
20 memcpy(buf, data, size);
21 buf[size] = 0;
22
23 // start fuzzing
24 credential_init(&c);
25 credential_from_url_gently(&c, buf, 1);
26
27 // cleanup
28 credential_clear(&c);
29 free(buf);
30
31 return 0;
32 }