Skip to content

Commit

Permalink
Fix crash in AppLayer Proto Detect
Browse files Browse the repository at this point in the history
The App Proto Detect code would use the wrong pattern count to
index a results array, leading to SEGVs.

Bug #1080.
  • Loading branch information
victorjulien committed Jan 17, 2014
1 parent 06f9b0a commit 9952db6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app-layer-detect-proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,10 @@ static uint16_t AppLayerProtoDetectPMGetProto(AppLayerProtoDetectThreadCtx *tctx
uint8_t pm_results_bf[(ALPROTO_MAX / 8) + 1];
memset(pm_results_bf, 0, sizeof(pm_results_bf));

for (cnt = 0; cnt < search_cnt; cnt++) {
/* loop through unique pattern id's. Can't use search_cnt here,
* as that contains all matches, tctx->pmq.pattern_id_array_cnt
* contains only *unique* matches. */
for (cnt = 0; cnt < tctx->pmq.pattern_id_array_cnt; cnt++) {
AppLayerProtoDetectPMSignature *s = pm_ctx->map[tctx->pmq.pattern_id_array[cnt]];
while (s != NULL) {
uint16_t proto = AppLayerProtoDetectPMMatchSignature(s, buf, searchlen, ipproto);
Expand Down

0 comments on commit 9952db6

Please sign in to comment.