/src/FreeRDP/libfreerdp/common/test/TestFuzzCommonAssistanceParseFileBuffer.c
Line | Count | Source (jump to first uncovered line) |
1 | | #include <freerdp/assistance.h> |
2 | | |
3 | | static int parse_file_buffer(const uint8_t* Data, size_t Size) |
4 | 0 | { |
5 | 0 | static const char TEST_MSRC_INCIDENT_PASSWORD_TYPE2[] = "48BJQ853X3B4"; |
6 | 0 | int status = -1; |
7 | 0 | rdpAssistanceFile* file = freerdp_assistance_file_new(); |
8 | 0 | if (!file) |
9 | 0 | return -1; |
10 | | |
11 | 0 | char* buf = calloc(Size + 1, sizeof(char)); |
12 | 0 | if (buf == NULL) |
13 | 0 | goto err; |
14 | 0 | memcpy(buf, Data, Size); |
15 | 0 | buf[Size] = '\0'; |
16 | |
|
17 | 0 | status = freerdp_assistance_parse_file_buffer(file, buf, Size + 1, |
18 | 0 | TEST_MSRC_INCIDENT_PASSWORD_TYPE2); |
19 | |
|
20 | 0 | err: |
21 | 0 | freerdp_assistance_file_free(file); |
22 | 0 | free(buf); |
23 | |
|
24 | 0 | return status >= 0 ? TRUE : FALSE; |
25 | 0 | } |
26 | | |
27 | | int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) |
28 | 0 | { |
29 | 0 | parse_file_buffer(Data, Size); |
30 | 0 | return 0; |
31 | 0 | } |