1 #define _GNU_SOURCE 2 #include <stdio.h> 3 #include <stdint.h> 4 #include <stdlib.h> 5 #include <stddef.h> 6 #include <string.h> 7 #include <fcntl.h> 8 #include <errno.h> 9 #include <unistd.h> 10 11 #include <sys/types.h> 12 #include <sys/stat.h> 13 14 #include "multipart_parser.h" 15 16 int LLVMFuzzerTestOneInput(const uint8_t *input, size_t size) 17 { 18 char *buf = NULL; 19 multipart_parser *p; 20 static multipart_parser_settings s = { 21 .on_part_data = NULL, 22 .on_headers_complete = NULL, 23 .on_part_data_end = NULL, 24 .on_header_field = NULL, 25 .on_header_value = NULL, 26 }; 27 buf = calloc(1, size + 1); 28 if (!buf) 29 return 0; 30 31 memcpy(buf, input, size); 32 p = multipart_parser_init(buf, &s); 33 if (!p) { 34 free(buf); 35 return 0; 36 } 37 38 multipart_parser_execute(p, buf, size + 1); 39 multipart_parser_free(p); 40 free(buf); 41 42 return 0; 43 } 44
This page was automatically generated by LXR 0.3.1. • OpenWrt