fix segv in hcbd and hsbd buffering.

Increase bufffers_list_len, only we open up a space for a new tx.
pull/147/merge
Anoop Saldanha 14 years ago committed by Victor Julien
parent b359bc03a9
commit 2ab62920aa

@ -93,6 +93,11 @@ static uint8_t *DetectEngineHCBDGetBufferForTX(int tx_id,
if (HCBDCreateSpace(det_ctx, 1) < 0)
goto end;
index = 0;
if (det_ctx->hcbd_buffers_list_len == 0) {
det_ctx->hcbd_start_tx_id = tx_id;
}
det_ctx->hcbd_buffers_list_len++;
} else {
if ((tx_id - det_ctx->hcbd_start_tx_id) < det_ctx->hcbd_buffers_list_len) {
if (det_ctx->hcbd[(tx_id - det_ctx->hcbd_start_tx_id)].buffer_len != 0) {
@ -102,15 +107,15 @@ static uint8_t *DetectEngineHCBDGetBufferForTX(int tx_id,
} else {
if (HCBDCreateSpace(det_ctx, (tx_id - det_ctx->hcbd_start_tx_id) + 1) < 0)
goto end;
if (det_ctx->hcbd_buffers_list_len == 0) {
det_ctx->hcbd_start_tx_id = tx_id;
}
det_ctx->hcbd_buffers_list_len++;
}
index = (tx_id - det_ctx->hcbd_start_tx_id);
}
if (det_ctx->hcbd_buffers_list_len == 0) {
det_ctx->hcbd_start_tx_id = tx_id;
}
det_ctx->hcbd_buffers_list_len++;
htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, tx_id);
if (tx == NULL) {
SCLogDebug("no tx");

@ -96,6 +96,11 @@ static uint8_t *DetectEngineHHDGetBufferForTX(int tx_id,
if (HHDCreateSpace(det_ctx, 1) < 0)
goto end;
index = 0;
if (det_ctx->hhd_buffers_list_len == 0) {
det_ctx->hhd_start_tx_id = tx_id;
}
det_ctx->hhd_buffers_list_len++;
} else {
if ((tx_id - det_ctx->hhd_start_tx_id) < det_ctx->hhd_buffers_list_len) {
if (det_ctx->hhd_buffers_len[(tx_id - det_ctx->hhd_start_tx_id)] != 0) {
@ -105,15 +110,15 @@ static uint8_t *DetectEngineHHDGetBufferForTX(int tx_id,
} else {
if (HHDCreateSpace(det_ctx, (tx_id - det_ctx->hhd_start_tx_id) + 1) < 0)
goto end;
if (det_ctx->hhd_buffers_list_len == 0) {
det_ctx->hhd_start_tx_id = tx_id;
}
det_ctx->hhd_buffers_list_len++;
}
index = (tx_id - det_ctx->hhd_start_tx_id);
}
if (det_ctx->hhd_buffers_list_len == 0) {
det_ctx->hhd_start_tx_id = tx_id;
}
det_ctx->hhd_buffers_list_len++;
htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, tx_id);
if (tx == NULL) {
SCLogDebug("no tx");

@ -94,6 +94,11 @@ static uint8_t *DetectEngineHSBDGetBufferForTX(int tx_id,
if (HSBDCreateSpace(det_ctx, 1) < 0)
goto end;
index = 0;
if (det_ctx->hsbd_buffers_list_len == 0) {
det_ctx->hsbd_start_tx_id = tx_id;
}
det_ctx->hsbd_buffers_list_len++;
} else {
if ((tx_id - det_ctx->hsbd_start_tx_id) < det_ctx->hsbd_buffers_list_len) {
if (det_ctx->hsbd[(tx_id - det_ctx->hsbd_start_tx_id)].buffer_len != 0) {
@ -103,15 +108,15 @@ static uint8_t *DetectEngineHSBDGetBufferForTX(int tx_id,
} else {
if (HSBDCreateSpace(det_ctx, (tx_id - det_ctx->hsbd_start_tx_id) + 1) < 0)
goto end;
if (det_ctx->hsbd_buffers_list_len == 0) {
det_ctx->hsbd_start_tx_id = tx_id;
}
det_ctx->hsbd_buffers_list_len++;
}
index = (tx_id - det_ctx->hsbd_start_tx_id);
}
if (det_ctx->hsbd_buffers_list_len == 0) {
det_ctx->hsbd_start_tx_id = tx_id;
}
det_ctx->hsbd_buffers_list_len++;
htp_tx_t *tx = list_get(htp_state->connp->conn->transactions, tx_id);
if (tx == NULL) {
SCLogDebug("no tx");

Loading…
Cancel
Save