|
|
|
@ -793,12 +793,9 @@ static inline uint8_t DetectRulePacketRules(ThreadVars *const tv,
|
|
|
|
/* undo "prefetch" */
|
|
|
|
/* undo "prefetch" */
|
|
|
|
if (next_s)
|
|
|
|
if (next_s)
|
|
|
|
match_array--;
|
|
|
|
match_array--;
|
|
|
|
/* create temporary rule pointer array starting
|
|
|
|
|
|
|
|
* at where we are in the current match array */
|
|
|
|
|
|
|
|
const Signature *replace[de_ctx->sig_array_len]; // TODO heap?
|
|
|
|
|
|
|
|
SCLogDebug("sig_array_len %u det_ctx->pmq.rule_id_array_cnt %u",
|
|
|
|
SCLogDebug("sig_array_len %u det_ctx->pmq.rule_id_array_cnt %u",
|
|
|
|
de_ctx->sig_array_len, det_ctx->pmq.rule_id_array_cnt);
|
|
|
|
de_ctx->sig_array_len, det_ctx->pmq.rule_id_array_cnt);
|
|
|
|
const Signature **r = replace;
|
|
|
|
const Signature **r = det_ctx->replace;
|
|
|
|
for (uint32_t x = 0; x < match_cnt; x++) {
|
|
|
|
for (uint32_t x = 0; x < match_cnt; x++) {
|
|
|
|
*r++ = match_array[x];
|
|
|
|
*r++ = match_array[x];
|
|
|
|
SCLogDebug("appended %u", match_array[x]->id);
|
|
|
|
SCLogDebug("appended %u", match_array[x]->id);
|
|
|
|
@ -814,7 +811,7 @@ static inline uint8_t DetectRulePacketRules(ThreadVars *const tv,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (match_cnt > 1) {
|
|
|
|
if (match_cnt > 1) {
|
|
|
|
qsort(replace, match_cnt, sizeof(Signature *), SortHelper);
|
|
|
|
qsort(det_ctx->replace, match_cnt, sizeof(Signature *), SortHelper);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* rewrite match_array to include the new additions, and deduplicate
|
|
|
|
/* rewrite match_array to include the new additions, and deduplicate
|
|
|
|
* while at it. */
|
|
|
|
* while at it. */
|
|
|
|
@ -828,7 +825,7 @@ static inline uint8_t DetectRulePacketRules(ThreadVars *const tv,
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
last_sig = *m;
|
|
|
|
last_sig = *m;
|
|
|
|
*m++ = (Signature *)replace[x];
|
|
|
|
*m++ = (Signature *)det_ctx->replace[x];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
match_cnt -= skipped;
|
|
|
|
match_cnt -= skipped;
|
|
|
|
/* prefetch next */
|
|
|
|
/* prefetch next */
|
|
|
|
|