Because the HTP personalities code changes how the htp state's connp is initialized, we need to check for it in more places.

remotes/origin/master-1.0.x
Victor Julien 16 years ago
parent ead13bda4a
commit 4129146a71

@ -146,9 +146,6 @@ static void *HTPStateAlloc(void)
error:
if (s != NULL) {
if (s->connp != NULL)
htp_connp_destroy(s->connp);
SCFree(s);
}
@ -262,6 +259,7 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
}
if (NULL == htp) {
BUG_ON(htp == NULL);
/* should never happen if HTPConfigure is properly invoked */
goto error;
}
@ -276,6 +274,9 @@ static int HTPHandleRequestData(Flow *f, void *htp_state,
SCLogDebug("New hstate->connp %p", hstate->connp);
}
/* the code block above should make sure connp is never NULL here */
BUG_ON(hstate->connp == NULL);
if (hstate->connp->in_status == STREAM_STATE_ERROR) {
SCLogError(SC_ERR_ALPARSER, "Inbound parser is in error state, no"
" need to feed data to libhtp");
@ -370,6 +371,10 @@ static int HTPHandleResponseData(Flow *f, void *htp_state,
int ret = 1;
HtpState *hstate = (HtpState *)htp_state;
if (hstate->connp == NULL) {
SCLogError(SC_ERR_ALPARSER, "HTP state has no connp");
SCReturnInt(-1);
}
if (hstate->connp->out_status == STREAM_STATE_ERROR) {
SCLogError(SC_ERR_ALPARSER, "Outbound parser is in error state, no"

@ -261,6 +261,11 @@ int DetectEngineInspectPacketUris(DetectEngineCtx *de_ctx,
goto end;
}
if (htp_state->connp == NULL) {
SCLogDebug("HTP state has no connp");
goto end;
}
sm = s->umatch;
det_ctx->uricontent_payload_offset = 0;

@ -387,8 +387,8 @@ uint32_t DetectUricontentInspectMpm(ThreadVars *tv, DetectEngineThreadCtx *det_c
htp_tx_t *tx = NULL;
HtpState *htp_state = (HtpState *)alstate;
if (htp_state == NULL) {
SCLogDebug("no HTTP state");
if (htp_state == NULL || htp_state->connp == NULL) {
SCLogDebug("no HTTP state / no connp");
SCReturnUInt(0U);
}

Loading…
Cancel
Save