static int UtilActionTest08(void)
{
int res = 0;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
"192.168.1.5", "192.168.1.1",
static int UtilActionTest09(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest10(void)
{
int res = 0;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
- uint8_t *buf2 = (uint8_t *)"wo!";
- uint16_t buflen2 = strlen((char *)buf2);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
+ uint8_t buf2[] = "wo!";
+ uint16_t buflen2 = sizeof(buf2) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
"192.168.1.5", "192.168.1.1",
static int UtilActionTest11(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
- uint8_t *buf2 = (uint8_t *)"Hi all wo!";
- uint16_t buflen2 = strlen((char *)buf2);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
+ uint8_t buf2[] = "Hi all wo!";
+ uint16_t buflen2 = sizeof(buf2) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest12(void)
{
int res = 0;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
"192.168.1.5", "192.168.1.1",
static int UtilActionTest13(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest14(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest15(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
static int UtilActionTest16(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
static int UtilActionTest17(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
p[0] = UTHBuildPacketReal((uint8_t *)buf, buflen, IPPROTO_TCP,
static int UtilActionTest18(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest19(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest20(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest21(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest22(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int UtilActionTest23(void)
{
int res = 1;
- uint8_t *buf = (uint8_t *)"Hi all!";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "Hi all!";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p[3];
action_order_sigs[0] = ACTION_DROP;
static int ByteTest07 (void)
{
- const char *str = "1234567890";
+ const char str[] = "1234567890";
uint64_t val = 1234567890;
uint64_t i64 = 0xbfbfbfbfbfbfbfbfULL;
- int ret = ByteExtractStringUint64(&i64, 10, strlen(str), str);
+ int ret = ByteExtractStringUint64(&i64, 10, sizeof(str) - 1, str);
if ((ret == 10) && (i64 == val)) {
return 1;
static int ByteTest08 (void)
{
- const char *str = "1234567890";
+ const char str[] = "1234567890";
uint32_t val = 1234567890;
uint32_t i32 = 0xbfbfbfbf;
- int ret = ByteExtractStringUint32(&i32, 10, strlen(str), str);
+ int ret = ByteExtractStringUint32(&i32, 10, sizeof(str) - 1, str);
if ((ret == 10) && (i32 == val)) {
return 1;
static int ByteTest09 (void)
{
- const char *str = "12345";
+ const char str[] = "12345";
uint16_t val = 12345;
uint16_t i16 = 0xbfbf;
- int ret = ByteExtractStringUint16(&i16, 10, strlen(str), str);
+ int ret = ByteExtractStringUint16(&i16, 10, sizeof(str) - 1, str);
if ((ret == 5) && (i16 == val)) {
return 1;
static int ByteTest10 (void)
{
- const char *str = "123";
+ const char str[] = "123";
uint8_t val = 123;
uint8_t i8 = 0xbf;
- int ret = ByteExtractStringUint8(&i8, 10, strlen(str), str);
+ int ret = ByteExtractStringUint8(&i8, 10, sizeof(str) - 1, str);
if ((ret == 3) && (i8 == val)) {
return 1;
static int ByteTest11 (void)
{
- const char *str = "-1234567890";
+ const char str[] = "-1234567890";
int64_t val = -1234567890;
int64_t i64 = 0xbfbfbfbfbfbfbfbfULL;
- int ret = ByteExtractStringInt64(&i64, 10, strlen(str), str);
+ int ret = ByteExtractStringInt64(&i64, 10, sizeof(str) - 1, str);
if ((ret == 11) && (i64 == val)) {
return 1;
static int ByteTest12 (void)
{
- const char *str = "-1234567890";
+ const char str[] = "-1234567890";
int32_t val = -1234567890;
int32_t i32 = 0xbfbfbfbf;
- int ret = ByteExtractStringInt32(&i32, 10, strlen(str), str);
+ int ret = ByteExtractStringInt32(&i32, 10, sizeof(str) - 1, str);
if ((ret == 11) && (i32 == val)) {
return 1;
static int ByteTest13 (void)
{
- const char *str = "-12345";
+ const char str[] = "-12345";
int16_t val = -12345;
int16_t i16 = 0xbfbf;
- int ret = ByteExtractStringInt16(&i16, 10, strlen(str), str);
+ int ret = ByteExtractStringInt16(&i16, 10, sizeof(str) - 1, str);
if ((ret == 6) && (i16 == val)) {
return 1;
static int ByteTest14 (void)
{
- const char *str = "-123";
+ const char str[] = "-123";
int8_t val = -123;
int8_t i8 = 0xbf;
- int ret = ByteExtractStringInt8(&i8, 10, strlen(str), str);
+ int ret = ByteExtractStringInt8(&i8, 10, sizeof(str) - 1, str);
if ((ret == 4) && (i8 == val)) {
return 1;
/** \test max u32 value */
static int ByteTest15 (void)
{
- const char *str = "4294967295";
+ const char str[] = "4294967295";
uint32_t val = 4294967295UL;
uint32_t u32 = 0xffffffff;
- int ret = ByteExtractStringUint32(&u32, 10, strlen(str), str);
+ int ret = ByteExtractStringUint32(&u32, 10, sizeof(str) - 1, str);
if ((ret == 10) && (u32 == val)) {
return 1;
}
/** \test max u32 value + 1 */
static int ByteTest16 (void)
{
- const char *str = "4294967296";
+ const char str[] = "4294967296";
uint32_t u32 = 0;
- int ret = ByteExtractStringUint32(&u32, 10, strlen(str), str);
+ int ret = ByteExtractStringUint32(&u32, 10, sizeof(str) - 1, str);
if (ret != 0) {
return 1;
}
static int MacSetTest03(void)
{
MacSet *ms = NULL;
- int i = 0;
SC_ATOMIC_SET(flow_config.memcap, 10000);
ms = MacSetInit(10);
FAIL_IF_NULL(ms);
FAIL_IF_NOT(MacSetSize(ms) == 0);
- for (i = 1; i < 100; i++) {
+ for (uint8_t i = 1; i < 100; i++) {
MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
addr1[5] = i;
static int MacSetTest05(void)
{
MacSet *ms = NULL;
- int ret = 0, i = 0;
+ int ret = 0;
SC_ATOMIC_SET(flow_config.memcap, 64);
ms = MacSetInit(10);
FAIL_IF_NULL(ms);
FAIL_IF_NOT(MacSetSize(ms) == 0);
- for (i = 1; i < 100; i++) {
+ for (uint8_t i = 1; i < 100; i++) {
MacAddr addr1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x1},
addr2 = {0x1, 0x0, 0x0, 0x0, 0x0, 0x1};
addr1[5] = i;
}
FAIL_IF_NOT(MacSetSize(ms) == 2);
- ret = MacSetForEach(ms, CheckTest1Membership, &i);
+ int i2 = 100;
+ ret = MacSetForEach(ms, CheckTest1Membership, &i2);
FAIL_IF_NOT(ret == 0);
MacSetFree(ms);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCD";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCD";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDE";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDE";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDEF";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDEF";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABC";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABC";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzAB";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzAB";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcde""fghij""klmno""pqrst""uvwxy""z";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcde"
+ "fghij"
+ "klmno"
+ "pqrst"
+ "uvwxy"
+ "z";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
SCACBSInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACBSPreparePatterns(&mpm_ctx);
static int SCACBSTest30(void)
{
- uint8_t *buf = (uint8_t *)"onetwothreefourfivesixseveneightnine";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "onetwothreefourfivesixseveneightnine";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCD";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCD";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDE";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDE";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDEF";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDEF";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABC";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABC";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzAB";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzAB";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcde""fghij""klmno""pqrst""uvwxy""z";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcde"
+ "fghij"
+ "klmno"
+ "pqrst"
+ "uvwxy"
+ "z";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
SCACTileInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACTilePreparePatterns(&mpm_ctx);
static int SCACTileTest29(void)
{
- uint8_t *buf = (uint8_t *)"onetwothreefourfivesixseveneightnine";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "onetwothreefourfivesixseveneightnine";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCD";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCD";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDE";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDE";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDEF";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDEF";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABC";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABC";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzAB";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzAB";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 match */
- const char *pat = "abcde""fghij""klmno""pqrst""uvwxy""z";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcde"
+ "fghij"
+ "klmno"
+ "pqrst"
+ "uvwxy"
+ "z";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
SCACInitThreadCtx(&mpm_ctx, &mpm_thread_ctx);
/* 1 */
- const char *pat = "AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AAAAA""AA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCACPreparePatterns(&mpm_ctx);
static int SCACTest29(void)
{
- uint8_t *buf = (uint8_t *)"onetwothreefourfivesixseveneightnine";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "onetwothreefourfivesixseveneightnine";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCD";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCD";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDE";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDE";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABCDEF";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABCDEF";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzABC";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzABC";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcdefghijklmnopqrstuvwxyzAB";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcdefghijklmnopqrstuvwxyzAB";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 match */
- const char *pat = "abcde"
- "fghij"
- "klmno"
- "pqrst"
- "uvwxy"
- "z";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "abcde"
+ "fghij"
+ "klmno"
+ "pqrst"
+ "uvwxy"
+ "z";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 */
- const char *pat = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
MpmInitCtx(&mpm_ctx, MPM_HS);
/* 1 */
- const char *pat = "AAAAA"
- "AAAAA"
- "AAAAA"
- "AAAAA"
- "AAAAA"
- "AAAAA"
- "AA";
- MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, strlen(pat), 0, 0, 0, 0, 0);
+ const char pat[] = "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AAAAA"
+ "AA";
+ MpmAddPatternCS(&mpm_ctx, (uint8_t *)pat, sizeof(pat) - 1, 0, 0, 0, 0, 0);
PmqSetup(&pmq);
SCHSPreparePatterns(&mpm_ctx);
static int SCHSTest29(void)
{
- uint8_t *buf = (uint8_t *)"onetwothreefourfivesixseveneightnine";
- uint16_t buflen = strlen((char *)buf);
+ uint8_t buf[] = "onetwothreefourfivesixseveneightnine";
+ uint16_t buflen = sizeof(buf) - 1;
Packet *p = NULL;
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
}
j = 0;
for (i = m; i > 0; --i) {
- if (suff[i-1] == i) {
+ if (suff[i - 1] == i) {
for (; j < m - i; ++j) {
if (bmGs[j] == m) {
bmGs[j] = m - i;
static uint8_t *BasicSearchWrapper(uint8_t *text, uint8_t *needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)needle);
uint8_t *ret = NULL;
int i = 0;
static uint8_t *BasicSearchNocaseWrapper(uint8_t *text, uint8_t *needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)needle);
uint8_t *ret = NULL;
int i = 0;
static uint8_t *Bs2bmWrapper(uint8_t *text, uint8_t *needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)needle);
uint8_t badchars[ALPHABET_SIZE];
Bs2BmBadchars(needle, needlelen, badchars);
static uint8_t *Bs2bmNocaseWrapper(uint8_t *text, uint8_t *needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)needle);
uint8_t badchars[ALPHABET_SIZE];
Bs2BmBadchars(needle, needlelen, badchars);
static uint8_t *BoyerMooreWrapper(uint8_t *text, uint8_t *needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)needle);
BmCtx *bm_ctx = BoyerMooreCtxInit(needle, needlelen);
static uint8_t *BoyerMooreNocaseWrapper(uint8_t *text, uint8_t *in_needle, int times)
{
uint32_t textlen = strlen((char *)text);
- uint16_t needlelen = strlen((char *)in_needle);
+ uint16_t needlelen = (uint16_t)strlen((char *)in_needle);
/* Make a copy of in_needle to be able to convert it to lowercase. */
uint8_t *needle = SCMalloc(needlelen);
uint16_t prefix;
for (prefix = 0; prefix < 32; prefix++) {
d.needle = needle;
- d.needle_len = strlen(needle);
+ d.needle_len = (uint16_t)strlen(needle);
uint16_t haystack_len = prefix + d.needle_len;
char *haystack = SCMalloc(haystack_len);
if (haystack == NULL) {
int i = 0;
int res = 1;
for (; i < numsids; i++) {
- uint16_t r = PacketAlertCheck(p, sids[i]);
+ uint32_t r = PacketAlertCheck(p, sids[i]);
if (r != results[i]) {
- SCLogInfo("Sid %"PRIu32" matched %"PRIu16" times, and not %"PRIu32
- " as expected", sids[i], r, results[i]);
+ SCLogInfo("Sid %" PRIu32 " matched %" PRIu32 " times, and not %" PRIu32 " as expected",
+ sids[i], r, results[i]);
res = 0;
} else {
- SCLogInfo("Sid %"PRIu32" matched %"PRIu16" times, as expected", sids[i], r);
+ SCLogInfo("Sid %" PRIu32 " matched %" PRIu32 " times, as expected", sids[i], r);
}
}
return res;