Go to the documentation of this file.
36 const uint8_t
separator[] = {0x01, 0xD5, 0xCA, 0x7A};
43 char *target_suffix = strrchr((*argv)[0],
'_');
44 if (target_suffix != NULL) {
53 const char *forceLayerStr = getenv(
"FUZZ_APPLAYER");
57 printf(
"Invalid numeric value for FUZZ_APPLAYER environment variable");
73 const uint8_t * albuffer;
78 uint8_t * isolatedBuffer;
82 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
83 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
114 f->
src.addr_data32[0] = 0x01020304;
115 f->
dst.addr_data32[0] = 0x05060708;
116 f->
sp = (uint16_t)((data[2] << 8) | data[3]);
117 f->
dp = (uint16_t)((data[4] << 8) | data[5]);
137 uint8_t
flags = STREAM_START;
139 alnext = memmem(albuffer, alsize,
separator, 4);
142 flags |= STREAM_TOCLIENT;
143 flags &= ~(STREAM_TOSERVER);
146 flags |= STREAM_TOSERVER;
147 flags &= ~(STREAM_TOCLIENT);
151 if (alnext != albuffer) {
153 isolatedBuffer = malloc(alnext - albuffer);
154 if (isolatedBuffer == NULL) {
157 memcpy(isolatedBuffer, albuffer, alnext - albuffer);
159 free(isolatedBuffer);
165 flags &= ~(STREAM_START);
167 (((
flags & STREAM_TOSERVER) != 0 &&
169 ((
flags & STREAM_TOCLIENT) != 0 &&
178 alsize -= alnext - albuffer + 4;
179 albuffer = alnext + 4;
183 alnext = memmem(albuffer, alsize,
separator, 4);
187 flags |= STREAM_TOCLIENT;
188 flags &= ~(STREAM_TOSERVER);
191 flags |= STREAM_TOSERVER;
192 flags &= ~(STREAM_TOCLIENT);
196 isolatedBuffer = malloc(alsize);
197 if (isolatedBuffer == NULL) {
200 memcpy(isolatedBuffer, albuffer, alsize);
202 free(isolatedBuffer);
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
void AppLayerParserTransactionsCleanup(Flow *f, const uint8_t pkt_dir)
remove obsolete (inspected and logged) transactions
int ByteExtractStringUint16(uint16_t *res, int base, size_t len, const char *str)
int LLVMFuzzerInitialize(int *argc, char ***argv)
const char * configNoChecksum
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
void SCRunmodeSet(int run_mode)
Set the current run mode.
void GlobalsInitPreConfig(void)
#define APP_LAYER_PARSER_EOF_TS
#define FLOWLOCK_UNLOCK(fb)
AppLayerParserState * alparser
const uint8_t separator[]
AppLayerParserThreadCtx * alp_tctx
AppProto StringToAppProto(const char *proto_name)
Maps a string to its ALPROTO_* equivalent.
#define FLOWLOCK_WRLOCK(fb)
int ConfYamlLoadString(const char *string, size_t len)
Load configuration from a YAML string.
int PostConfLoadedSetup(SCInstance *suri)
uint8_t FlowGetProtoMapping(uint8_t proto)
Function to map the protocol to the defined FLOW_PROTO_* enumeration.
#define APP_LAYER_PARSER_EOF_TC
void setenv(const char *name, const char *value, int overwrite)
AppLayerParserThreadCtx * AppLayerParserThreadCtxAlloc(void)
Gets a new app layer protocol's parser thread context.
int AppLayerParserParse(ThreadVars *tv, AppLayerParserThreadCtx *alp_tctx, Flow *f, AppProto alproto, uint8_t flags, const uint8_t *input, uint32_t input_len)
void FlowFree(Flow *f)
cleanup & free the memory of a flow
TmEcode ConfigSetLogDirectory(const char *name)
SC_ATOMIC_EXTERN(unsigned int, engine_stage)
int InitGlobal(void)
Global initialization common to all runmodes.
int FlowChangeProto(Flow *f)
Check if change proto flag is set for flow.
Flow * FlowAlloc(void)
allocate a flow
uint16_t AppLayerParserStateIssetFlag(AppLayerParserState *pstate, uint16_t flag)
AppProto alproto
application level protocol
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)