/src/git/oss-fuzz/fuzz-credential-from-url-gently.c
Line | Count | Source |
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 | 877 | { |
13 | 877 | struct credential c; |
14 | 877 | char *buf; |
15 | | |
16 | 877 | buf = malloc(size + 1); |
17 | 877 | if (!buf) |
18 | 0 | return 0; |
19 | | |
20 | 877 | memcpy(buf, data, size); |
21 | 877 | buf[size] = 0; |
22 | | |
23 | | // start fuzzing |
24 | 877 | credential_init(&c); |
25 | 877 | credential_from_url_gently(&c, buf, 1); |
26 | | |
27 | | // cleanup |
28 | 877 | credential_clear(&c); |
29 | 877 | free(buf); |
30 | | |
31 | 877 | return 0; |
32 | 877 | } |