result &= (0 == pca->head[1].wrapped_syncs);
result &= (3.5 == *((double *)tv.sc_perf_pctx.head->value->cvalue) );
- SCPerfCounterAddUI64(id2, pca, 1.635);
- SCPerfCounterAddUI64(id2, pca, 2.12);
- SCPerfCounterAddUI64(id2, pca, 3.74);
- SCPerfCounterAddUI64(id2, pca, 4.23);
- SCPerfCounterAddUI64(id2, pca, 5.76);
+ SCPerfCounterAddUI64(id2, pca, (uint64_t)1.635);
+ SCPerfCounterAddUI64(id2, pca, (uint64_t)2.12);
+ SCPerfCounterAddUI64(id2, pca, (uint64_t)3.74);
+ SCPerfCounterAddUI64(id2, pca, (uint64_t)4.23);
+ SCPerfCounterAddUI64(id2, pca, (uint64_t)5.76);
SCPerfCounterAddDouble(id2, pca, 6.99999);
SCPerfUpdateCounterArray(pca, &tv.sc_perf_pctx, 0);
ip4h.s_ip_dst.s_addr = 0x02020202; /* 2.2.2.2 */
/* copy content_len crap, we need full length */
- PacketCopyData(p, (uint8_t *)&ip4h, sizeof(ip4h) + content_len);
+ PacketCopyData(p, (uint8_t *)&ip4h, sizeof(ip4h));
p->ip4h = (IPV4Hdr *)GET_PKT_DATA(p);
SET_IPV4_SRC_ADDR(p, &p->src);
SET_IPV4_DST_ADDR(p, &p->dst);
ip6h.s_ip6_dst[3] = 0x02020202;
/* copy content_len crap, we need full length */
- PacketCopyData(p, (uint8_t *)&ip6h, sizeof(IPV6Hdr) + sizeof(IPV6FragHdr) + content_len);
+ PacketCopyData(p, (uint8_t *)&ip6h, sizeof(IPV6Hdr));
p->ip6h = (IPV6Hdr *)GET_PKT_DATA(p);
IPV6_SET_RAW_VER(p->ip6h, 6);
{
int result = 0;
DetectEngineCtx *de_ctx = NULL;
+ Signature *s = NULL;
+ ThreadVars tv;
+ DetectEngineThreadCtx *det_ctx = NULL;
+ DecodeThreadVars dtv;
Packet *p = PacketGetFromAlloc();
if (p == NULL) {
PacketCopyData(p, pkt, sizeof(pkt));
- Signature *s = NULL;
- ThreadVars tv;
- DetectEngineThreadCtx *det_ctx = NULL;
- DecodeThreadVars dtv;
memset(&tv, 0, sizeof(tv));
memset(&dtv, 0, sizeof(dtv));
return 0;
}
-
static uint8_t *DetectEngineHHDGetBufferForTX(htp_tx_t *tx, uint64_t tx_id,
DetectEngineCtx *de_ctx,
DetectEngineThreadCtx *det_ctx,
det_ctx->hhd_buffers[index] = headers_buffer;
det_ctx->hhd_buffers_len[index] = headers_buffer_len;
- *buffer_len = headers_buffer_len;
+ *buffer_len = (uint32_t)headers_buffer_len;
end:
return headers_buffer;
}
static int DetectFlowSigTest01(void)
{
int result = 0;
-
+ ThreadVars th_v;
+ DecodeThreadVars dtv;
+ DetectEngineCtx *de_ctx = NULL;
+ DetectEngineThreadCtx *det_ctx = NULL;
uint8_t *buf = (uint8_t *)"supernovaduper";
uint16_t buflen = strlen((char *)buf);
+
Packet *p = UTHBuildPacket(buf, buflen, IPPROTO_TCP);
if (p->flow != NULL) {
printf("packet has flow set\n");
char *sig1 = "alert tcp any any -> any any (msg:\"dummy\"; "
"content:\"nova\"; flow:no_stream; sid:1;)";
- ThreadVars th_v;
- DecodeThreadVars dtv;
- DetectEngineThreadCtx *det_ctx = NULL;
-
memset(&dtv, 0, sizeof(DecodeThreadVars));
memset(&th_v, 0, sizeof(th_v));
- DetectEngineCtx *de_ctx = DetectEngineCtxInit();
+ de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL) {
printf("de_ctx == NULL: ");
goto end;
}
ThreadVars th_v;
- DetectEngineThreadCtx *det_ctx;
+ DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
memset(&th_v, 0, sizeof(ThreadVars));
return 0;
}
ThreadVars th_v;
- DetectEngineThreadCtx *det_ctx;
+ DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
memset(&th_v, 0, sizeof(ThreadVars));
return 0;
}
ThreadVars th_v;
- DetectEngineThreadCtx *det_ctx;
+ DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
memset(&th_v, 0, sizeof(ThreadVars));
}
static int FlowStorageTest01(void) {
+ Flow *f = NULL;
+
StorageInit();
int id1 = FlowStorageRegister("test", 8, StorageTestAlloc, StorageTestFree);
goto error;
FlowInitConfig(FLOW_QUIET);
- Flow *f = FlowAlloc();
+
+ f = FlowAlloc();
if (f == NULL) {
goto error;
}
StorageCleanup();
return 1;
error:
- FlowClearMemory(f, 0);
- FlowFree(f);
+ if (f != NULL) {
+ FlowClearMemory(f, 0);
+ FlowFree(f);
+ }
FlowShutdown();
StorageCleanup();
return 0;
}
static int FlowStorageTest02(void) {
+ Flow *f = NULL;
+
StorageInit();
int id1 = FlowStorageRegister("test", sizeof(void *), NULL, StorageTestFree);
goto error;
FlowInitConfig(FLOW_QUIET);
- Flow *f = FlowAlloc();
+ f = FlowAlloc();
if (f == NULL) {
goto error;
}
StorageCleanup();
return 1;
error:
- FlowClearMemory(f, 0);
- FlowFree(f);
+ if (f != NULL) {
+ FlowClearMemory(f, 0);
+ FlowFree(f);
+ }
FlowShutdown();
StorageCleanup();
return 0;
}
static int FlowStorageTest03(void) {
+ Flow *f = NULL;
+
StorageInit();
int id1 = FlowStorageRegister("test1", sizeof(void *), NULL, StorageTestFree);
goto error;
FlowInitConfig(FLOW_QUIET);
- Flow *f = FlowAlloc();
+ f = FlowAlloc();
if (f == NULL) {
goto error;
}
StorageCleanup();
return 1;
error:
- FlowClearMemory(f, 0);
- FlowFree(f);
+ if (f != NULL) {
+ FlowClearMemory(f, 0);
+ FlowFree(f);
+ }
FlowShutdown();
StorageCleanup();
return 0;
B3gPreparePatterns(&mpm_ctx);
B3gThreadInitCtx(&mpm_ctx, &mpm_thread_ctx, 1 /* 1 pattern */);
- uint32_t cnt = ctx->Search(&mpm_ctx, &mpm_thread_ctx, NULL, (uint8_t *)"012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679abcdefgh012345679012345679012345679012345679012345679012345679012345679012345679012345679012345679", 208);
+ char *input = "012345679012345679012345679012345679012345679012345679"
+ "012345679012345679012345679012345679abcdefgh0123456790"
+ "123456790123456790123456790123456790123456790123456790"
+ "12345679012345679012345679";
+
+ uint32_t cnt = ctx->Search(&mpm_ctx, &mpm_thread_ctx, NULL, (uint8_t *)input, strlen(input));
if (cnt == 1)
result = 1;