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