added null checks for init_hash to all ac mpms

remotes/origin/HEAD
Eileen Donlon 14 years ago committed by Victor Julien
parent 617edf469c
commit 0bb4ff34b8

@ -192,7 +192,7 @@ static inline SCACBSPattern *SCACBSInitHashLookup(SCACBSCtx *ctx, uint8_t *pat,
{
uint32_t hash = SCACBSInitHashRaw(pat, patlen);
if (ctx->init_hash[hash] == NULL) {
if (ctx->init_hash == NULL || ctx->init_hash[hash] == NULL) {
return NULL;
}
@ -293,6 +293,10 @@ static inline int SCACBSInitHashAdd(SCACBSCtx *ctx, SCACBSPattern *p)
{
uint32_t hash = SCACBSInitHash(p);
if (ctx->init_hash == NULL) {
return 0;
}
if (ctx->init_hash[hash] == NULL) {
ctx->init_hash[hash] = p;
return 0;
@ -1162,7 +1166,7 @@ int SCACBSPreparePatterns(MpmCtx *mpm_ctx)
{
SCACBSCtx *ctx = (SCACBSCtx *)mpm_ctx->ctx;
if (mpm_ctx->pattern_cnt == 0) {
if (mpm_ctx->pattern_cnt == 0 || ctx->init_hash == NULL) {
SCLogDebug("no patterns supplied to this mpm_ctx");
return 0;
}

@ -186,7 +186,7 @@ static inline SCACGfbsPattern *SCACGfbsInitHashLookup(SCACGfbsCtx *ctx, uint8_t
{
uint32_t hash = SCACGfbsInitHashRaw(pat, patlen);
if (ctx->init_hash[hash] == NULL) {
if (ctx->init_hash == NULL || ctx->init_hash[hash] == NULL) {
return NULL;
}
@ -287,6 +287,10 @@ static inline int SCACGfbsInitHashAdd(SCACGfbsCtx *ctx, SCACGfbsPattern *p)
{
uint32_t hash = SCACGfbsInitHash(p);
if (ctx->init_hash == NULL) {
return 0;
}
if (ctx->init_hash[hash] == NULL) {
ctx->init_hash[hash] = p;
return 0;
@ -1036,7 +1040,7 @@ int SCACGfbsPreparePatterns(MpmCtx *mpm_ctx)
{
SCACGfbsCtx *ctx = (SCACGfbsCtx *)mpm_ctx->ctx;
if (mpm_ctx->pattern_cnt == 0) {
if (mpm_ctx->pattern_cnt == 0 || ctx->init_hash == NULL) {
SCLogDebug("No patterns supplied to this mpm_ctx");
return 0;
}

@ -192,7 +192,7 @@ static inline SCACPattern *SCACInitHashLookup(SCACCtx *ctx, uint8_t *pat,
{
uint32_t hash = SCACInitHashRaw(pat, patlen);
if (ctx->init_hash[hash] == NULL) {
if (ctx->init_hash == NULL || ctx->init_hash[hash] == NULL) {
return NULL;
}
@ -293,6 +293,10 @@ static inline int SCACInitHashAdd(SCACCtx *ctx, SCACPattern *p)
{
uint32_t hash = SCACInitHash(p);
if (ctx->init_hash == NULL) {
return 0;
}
if (ctx->init_hash[hash] == NULL) {
ctx->init_hash[hash] = p;
return 0;
@ -953,7 +957,7 @@ int SCACPreparePatterns(MpmCtx *mpm_ctx)
{
SCACCtx *ctx = (SCACCtx *)mpm_ctx->ctx;
if (mpm_ctx->pattern_cnt == 0) {
if (mpm_ctx->pattern_cnt == 0 || ctx->init_hash == NULL) {
SCLogDebug("no patterns supplied to this mpm_ctx");
return 0;
}

Loading…
Cancel
Save