mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-01 16:30:17 +00:00
fuzz: extend fuzz coverage (#1888)
This commit is contained in:
parent
06d4f8c7e5
commit
4075324e2b
346 changed files with 256 additions and 59 deletions
25
fuzz/fuzz_libinjection.c
Normal file
25
fuzz/fuzz_libinjection.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "ndpi_api.h"
|
||||
#include "../src/lib/third_party/include/libinjection.h"
|
||||
#include "../src/lib/third_party/include/libinjection_xss.h"
|
||||
#include "../src/lib/third_party/include/libinjection_sqli.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
char *query;
|
||||
char fingerprint[8];
|
||||
|
||||
/* No memory allocations involved */
|
||||
|
||||
/* Libinjection: it wants null-terminated string */
|
||||
|
||||
query = malloc(size + 1);
|
||||
memcpy(query, data, size);
|
||||
query[size] = '\0';
|
||||
|
||||
libinjection_sqli(query, strlen(query), fingerprint);
|
||||
|
||||
libinjection_xss(query, strlen(query));
|
||||
|
||||
free(query);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue