Go to the documentation of this file.
28 static int initialized = 0;
36 "Host: suricata.fuzz\r\n\r\n";
45 if (initialized == 0) {
47 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
48 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
59 remove(
"/tmp/fuzz.rules");
75 memset(&
f, 0,
sizeof(
f));
76 memset(&
ssn, 0,
sizeof(
ssn));
100 bool rep = data[0] & 1;
106 while (kw_len < size && data[kw_len] !=
';') {
109 if (kw_len >= size) {
115 const uint8_t *dataset_data = data + kw_len + 1;
116 size_t dataset_len = 0;
117 while (kw_len + 1 + dataset_len < size && data[kw_len + 1 + dataset_len] != 0) {
120 const uint8_t *uri_data = data + kw_len + 1 + dataset_len + 1;
122 if (size > (kw_len + 1 + dataset_len + 1))
123 uri_len = size - (kw_len + 1 + dataset_len + 1);
127 size_t sig_len =
strlcat(sig_buf,
"alert http any any -> any any (http.uri; ",
sizeof(sig_buf));
132 sig_len +=
strlcat(sig_buf + sig_len,
"datarep:",
sizeof(sig_buf) - sig_len);
134 sig_len +=
strlcat(sig_buf + sig_len,
"dataset:",
sizeof(sig_buf) - sig_len);
136 memcpy(sig_buf + sig_len, data, kw_len);
138 sig_len +=
strlcat(sig_buf + sig_len,
"; sid:1;)",
sizeof(sig_buf) - sig_len);
void FlowCleanupAppLayer(Flow *f)
DetectEngineThreadCtx * DetectEngineThreadCtxInitForReload(ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt)
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
main detection engine ctx
AppLayerParserThreadCtx * alp_tctx
DetectEngineCtx * DetectEngineGetCurrent(void)
#define FLOW_PKT_TOSERVER
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
void GlobalsInitPreConfig(void)
#define FLOWLOCK_UNLOCK(fb)
void PacketPoolInit(void)
ThreadVars * ThreadVarsAlloc(void)
Allocate a new ThreadVars structure.
void SCRunmodeSet(SCRunMode run_mode)
Set the current run mode.
void StreamTcpInitConfig(bool)
To initialize the stream global configuration data.
#define FLOW_INITIALIZE(f)
SCRunMode SCRunmodeGet(void)
Get the current run mode.
void PreRunPostPrivsDropInit(const int runmode)
size_t strlcat(char *, const char *src, size_t siz)
#define FLOWLOCK_WRLOCK(fb)
Per thread variable structure.
int TestHelperBufferToFile(const char *name, const uint8_t *data, size_t size)
writes the contents of a buffer into a file
int PostConfLoadedSetup(SCInstance *suri)
void DatasetsDestroy(void)
SC_ATOMIC_EXTERN(unsigned int, engine_stage)
void PostConfLoadedDetectSetup(SCInstance *suri)
TmModule tmm_modules[TMM_SIZE]
#define DETECT_MAX_RULE_SIZE
TmEcode ConfigSetDataDirectory(char *name)
void setenv(const char *name, const char *value, int overwrite)
uint32_t max_pending_packets
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
void * FlowWorkerGetDetectCtxPtr(void *flow_worker)
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
TmEcode(* ThreadInit)(ThreadVars *, const void *, void **)
TmEcode ConfigSetLogDirectory(const char *name)
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
#define FLOW_PKT_ESTABLISHED
void PacketAlertRecycle(PacketAlert *pa_array, uint16_t cnt)
int DetectEngineReload(const SCInstance *suri)
Reload the detection engine.
int InitGlobal(void)
Global initialization common to all runmodes.
AppProto alproto
application level protocol
void FlowWorkerReplaceDetectCtx(void *flow_worker, void *detect_ctx)