const uint8_t *data;
uint32_t data_len;
if (rs_dns_tx_get_query_name(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
InspectionBufferSetupMulti(buffer, transforms, data, data_len);
if (fo_inspect_offset >= (uint64_t)frame->len) {
SCLogDebug("data entirely past frame (%" PRIu64 " > %" PRIi64 ")",
fo_inspect_offset, frame->len);
+ InspectionBufferSetupMultiEmpty(buffer);
return false;
}
}
}
+/** \brief setup the buffer empty */
+void InspectionBufferSetupMultiEmpty(InspectionBuffer *buffer)
+{
+#ifdef DEBUG_VALIDATION
+ DEBUG_VALIDATE_BUG_ON(buffer->initialized);
+ DEBUG_VALIDATE_BUG_ON(!buffer->multi);
+#endif
+ buffer->inspect = NULL;
+ buffer->inspect_len = 0;
+ buffer->len = 0;
+ buffer->initialized = true;
+}
+
/** \brief setup the buffer with our initial data */
void InspectionBufferSetupMulti(InspectionBuffer *buffer, const DetectEngineTransforms *transforms,
const uint8_t *data, const uint32_t data_len)
const DetectEngineTransforms *transforms);
void InspectionBufferClean(DetectEngineThreadCtx *det_ctx);
InspectionBuffer *InspectionBufferGet(DetectEngineThreadCtx *det_ctx, const int list_id);
+void InspectionBufferSetupMultiEmpty(InspectionBuffer *buffer);
void InspectionBufferSetupMulti(InspectionBuffer *buffer, const DetectEngineTransforms *transforms,
const uint8_t *data, const uint32_t data_len);
InspectionBuffer *InspectionBufferMultipleForListGet(
/* no new data */
if (cur_file->content_inspected == file_size) {
SCLogDebug("no new data");
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
if (file_size == 0) {
SCLogDebug("no data to inspect for this transaction");
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
SCLogDebug("we still haven't seen the entire content. "
"Let's defer content inspection till we see the "
"entire content.");
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
DetectFilemagicThreadData *tfilemagic =
(DetectFilemagicThreadData *)DetectThreadCtxGetKeywordThreadCtx(det_ctx, g_magic_thread_ctx_id);
if (tfilemagic == NULL) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
uint32_t b_len = 0;
const uint8_t *b = NULL;
- if (rs_http2_tx_get_header(cbdata->txv, flags, cbdata->local_id, &b, &b_len) != 1)
+ if (rs_http2_tx_get_header(cbdata->txv, flags, cbdata->local_id, &b, &b_len) != 1) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
- if (b == NULL || b_len == 0)
+ }
+ if (b == NULL || b_len == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
+ }
InspectionBufferSetupMulti(buffer, transforms, b, b_len);
const uint8_t *data;
uint32_t data_len;
if (rs_ike_tx_get_vendor(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
uint32_t b_len = 0;
const uint8_t *b = NULL;
- if (rs_krb5_tx_get_cname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1)
+ if (rs_krb5_tx_get_cname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
- if (b == NULL || b_len == 0)
+ }
+ if (b == NULL || b_len == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
+ }
InspectionBufferSetupMulti(buffer, transforms, b, b_len);
uint32_t b_len = 0;
const uint8_t *b = NULL;
- if (rs_krb5_tx_get_sname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1)
+ if (rs_krb5_tx_get_sname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
- if (b == NULL || b_len == 0)
+ }
+ if (b == NULL || b_len == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
+ }
InspectionBufferSetupMulti(buffer, transforms, b, b_len);
const uint8_t *data;
uint32_t data_len;
if (rs_mqtt_tx_get_subscribe_topic(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
const uint8_t *data;
uint32_t data_len;
if (rs_mqtt_tx_get_unsubscribe_topic(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
const uint8_t *data;
uint32_t data_len;
if (rs_quic_tx_get_cyu_hash(cbdata->txv, (uint16_t)cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
const uint8_t *data;
uint32_t data_len;
if (rs_quic_tx_get_cyu_string(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
}
if (TAILQ_EMPTY(&connp->certs)) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}
cbdata->cert = TAILQ_NEXT(cbdata->cert, next);
}
if (cbdata->cert == NULL) {
+ InspectionBufferSetupMultiEmpty(buffer);
return NULL;
}