diff --git a/rust/src/dns/dns.rs b/rust/src/dns/dns.rs index 350c165aee..b541e775e4 100644 --- a/rust/src/dns/dns.rs +++ b/rust/src/dns/dns.rs @@ -888,7 +888,7 @@ pub extern "C" fn rs_dns_state_get_tx_data( #[no_mangle] pub extern "C" fn rs_dns_tx_get_query_name(tx: &mut DNSTransaction, - i: u16, + i: u32, buf: *mut *const u8, len: *mut u32) -> u8 diff --git a/rust/src/ike/detect.rs b/rust/src/ike/detect.rs index 78f60c8d67..fc5bef396e 100644 --- a/rust/src/ike/detect.rs +++ b/rust/src/ike/detect.rs @@ -117,9 +117,9 @@ pub extern "C" fn rs_ike_state_get_key_exchange( #[no_mangle] pub extern "C" fn rs_ike_tx_get_vendor( - tx: &IKETransaction, i: u16, buf: *mut *const u8, len: *mut u32, + tx: &IKETransaction, i: u32, buf: *mut *const u8, len: *mut u32, ) -> u8 { - if tx.ike_version == 1 && i < tx.hdr.ikev1_header.vendor_ids.len() as u16 { + if tx.ike_version == 1 && i < tx.hdr.ikev1_header.vendor_ids.len() as u32 { unsafe { *len = tx.hdr.ikev1_header.vendor_ids[i as usize].len() as u32; *buf = tx.hdr.ikev1_header.vendor_ids[i as usize].as_ptr(); diff --git a/rust/src/krb/detect.rs b/rust/src/krb/detect.rs index 127903d734..aa451782b8 100644 --- a/rust/src/krb/detect.rs +++ b/rust/src/krb/detect.rs @@ -43,7 +43,7 @@ pub unsafe extern "C" fn rs_krb5_tx_get_errcode(tx: &mut KRB5Transaction, #[no_mangle] pub unsafe extern "C" fn rs_krb5_tx_get_cname(tx: &mut KRB5Transaction, - i: u16, + i: u32, buffer: *mut *const u8, buffer_len: *mut u32) -> u8 @@ -61,7 +61,7 @@ pub unsafe extern "C" fn rs_krb5_tx_get_cname(tx: &mut KRB5Transaction, #[no_mangle] pub unsafe extern "C" fn rs_krb5_tx_get_sname(tx: &mut KRB5Transaction, - i: u16, + i: u32, buffer: *mut *const u8, buffer_len: *mut u32) -> u8 diff --git a/rust/src/mqtt/detect.rs b/rust/src/mqtt/detect.rs index 2e02bdffab..fc8c297797 100644 --- a/rust/src/mqtt/detect.rs +++ b/rust/src/mqtt/detect.rs @@ -353,7 +353,7 @@ pub extern "C" fn rs_mqtt_tx_get_publish_message( #[no_mangle] pub extern "C" fn rs_mqtt_tx_get_subscribe_topic(tx: &MQTTTransaction, - i: u16, + i: u32, buf: *mut *const u8, len: *mut u32) -> u8 @@ -386,7 +386,7 @@ pub extern "C" fn rs_mqtt_tx_get_subscribe_topic(tx: &MQTTTransaction, #[no_mangle] pub extern "C" fn rs_mqtt_tx_get_unsubscribe_topic(tx: &MQTTTransaction, - i: u16, + i: u32, buf: *mut *const u8, len: *mut u32) -> u8 @@ -607,4 +607,4 @@ mod test { r = rs_mqtt_tx_get_subscribe_topic(&t, 4, &mut s, &mut slen); assert_eq!(r, 0); } -} \ No newline at end of file +} diff --git a/src/detect-dns-query.c b/src/detect-dns-query.c index 36a7a996b1..50728041f2 100644 --- a/src/detect-dns-query.c +++ b/src/detect-dns-query.c @@ -68,7 +68,7 @@ static void DetectDnsQueryRegisterTests(void); static int g_dns_query_buffer_id = 0; struct DnsQueryGetDataArgs { - int local_id; /**< used as index into thread inspect array */ + uint32_t local_id; /**< used as index into thread inspect array */ void *txv; }; @@ -87,8 +87,7 @@ static InspectionBuffer *DnsQueryGetData(DetectEngineThreadCtx *det_ctx, const uint8_t *data; uint32_t data_len; - if (rs_dns_tx_get_query_name(cbdata->txv, (uint16_t)cbdata->local_id, - &data, &data_len) == 0) { + if (rs_dns_tx_get_query_name(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) { return NULL; } InspectionBufferSetupMulti(buffer, transforms, data, data_len); @@ -102,7 +101,7 @@ static int DetectEngineInspectDnsQuery( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -159,7 +158,7 @@ static void PrefilterTxDnsQuery(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { // loop until we get a NULL diff --git a/src/detect-engine-mpm.h b/src/detect-engine-mpm.h index 4751808474..e9ed4078cc 100644 --- a/src/detect-engine-mpm.h +++ b/src/detect-engine-mpm.h @@ -125,7 +125,7 @@ typedef struct PrefilterMpmListId { } PrefilterMpmListId; struct MpmListIdDataArgs { - int local_id; /**< used as index into thread inspect array */ + uint32_t local_id; /**< used as index into thread inspect array */ void *txv; }; diff --git a/src/detect-http2.c b/src/detect-http2.c index 917230bba1..cffbcbbfa4 100644 --- a/src/detect-http2.c +++ b/src/detect-http2.c @@ -701,7 +701,7 @@ static InspectionBuffer *GetHttp2HNameData(DetectEngineThreadCtx *det_ctx, uint32_t b_len = 0; const uint8_t *b = NULL; - if (rs_http2_tx_get_header_name(cbdata->txv, flags, (uint32_t)cbdata->local_id, &b, &b_len) != 1) + if (rs_http2_tx_get_header_name(cbdata->txv, flags, cbdata->local_id, &b, &b_len) != 1) return NULL; if (b == NULL || b_len == 0) return NULL; @@ -723,7 +723,7 @@ static void PrefilterTxHttp2HName(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { // loop until we get a NULL @@ -767,7 +767,7 @@ static int DetectEngineInspectHttp2HeaderName( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -835,7 +835,7 @@ static InspectionBuffer *GetHttp2HeaderData(DetectEngineThreadCtx *det_ctx, uint32_t b_len = 0; const uint8_t *b = NULL; - if (rs_http2_tx_get_header(cbdata->txv, flags, (uint32_t)cbdata->local_id, &b, &b_len) != 1) + if (rs_http2_tx_get_header(cbdata->txv, flags, cbdata->local_id, &b, &b_len) != 1) return NULL; if (b == NULL || b_len == 0) return NULL; @@ -856,7 +856,7 @@ static void PrefilterTxHttp2Header(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { // loop until we get a NULL @@ -899,7 +899,7 @@ static int DetectEngineInspectHttp2Header( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { diff --git a/src/detect-ike-vendor.c b/src/detect-ike-vendor.c index c336f8c594..eaa1d52ed8 100644 --- a/src/detect-ike-vendor.c +++ b/src/detect-ike-vendor.c @@ -41,7 +41,7 @@ typedef struct { } DetectIkeVendorData; struct IkeVendorGetDataArgs { - int local_id; + uint32_t local_id; void *txv; }; @@ -68,7 +68,7 @@ static InspectionBuffer *IkeVendorGetData(DetectEngineThreadCtx *det_ctx, const uint8_t *data; uint32_t data_len; - if (rs_ike_tx_get_vendor(cbdata->txv, (uint16_t)cbdata->local_id, &data, &data_len) == 0) { + if (rs_ike_tx_get_vendor(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) { return NULL; } @@ -94,7 +94,7 @@ static void PrefilterTxIkeVendor(DetectEngineThreadCtx *det_ctx, const void *pec const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while (1) { struct IkeVendorGetDataArgs cbdata = { local_id, txv }; InspectionBuffer *buffer = @@ -136,7 +136,7 @@ static int DetectEngineInspectIkeVendor(DetectEngineCtx *de_ctx, DetectEngineThr const DetectEngineAppInspectionEngine *engine, const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { diff --git a/src/detect-krb5-cname.c b/src/detect-krb5-cname.c index 7e90d679c2..9ae593a8f2 100644 --- a/src/detect-krb5-cname.c +++ b/src/detect-krb5-cname.c @@ -39,7 +39,7 @@ static int g_krb5_cname_buffer_id = 0; struct Krb5PrincipalNameDataArgs { - int local_id; /**< used as index into thread inspect array */ + uint32_t local_id; /**< used as index into thread inspect array */ void *txv; }; @@ -71,7 +71,7 @@ static InspectionBuffer *GetKrb5CNameData(DetectEngineThreadCtx *det_ctx, uint32_t b_len = 0; const uint8_t *b = NULL; - if (rs_krb5_tx_get_cname(cbdata->txv, (uint16_t)cbdata->local_id, &b, &b_len) != 1) + if (rs_krb5_tx_get_cname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1) return NULL; if (b == NULL || b_len == 0) return NULL; @@ -87,7 +87,7 @@ static int DetectEngineInspectKrb5CName( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -146,7 +146,7 @@ static void PrefilterTxKrb5CName(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { // loop until we get a NULL diff --git a/src/detect-krb5-sname.c b/src/detect-krb5-sname.c index a791c658d4..6adb73695f 100644 --- a/src/detect-krb5-sname.c +++ b/src/detect-krb5-sname.c @@ -39,7 +39,7 @@ static int g_krb5_sname_buffer_id = 0; struct Krb5PrincipalNameDataArgs { - int local_id; /**< used as index into thread inspect array */ + uint32_t local_id; /**< used as index into thread inspect array */ void *txv; }; @@ -71,7 +71,7 @@ static InspectionBuffer *GetKrb5SNameData(DetectEngineThreadCtx *det_ctx, uint32_t b_len = 0; const uint8_t *b = NULL; - if (rs_krb5_tx_get_sname(cbdata->txv, (uint16_t)cbdata->local_id, &b, &b_len) != 1) + if (rs_krb5_tx_get_sname(cbdata->txv, cbdata->local_id, &b, &b_len) != 1) return NULL; if (b == NULL || b_len == 0) return NULL; @@ -87,7 +87,7 @@ static int DetectEngineInspectKrb5SName( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -146,7 +146,7 @@ static void PrefilterTxKrb5SName(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { // loop until we get a NULL diff --git a/src/detect-mqtt-subscribe-topic.c b/src/detect-mqtt-subscribe-topic.c index 0c035f2c83..e8939ee4fc 100644 --- a/src/detect-mqtt-subscribe-topic.c +++ b/src/detect-mqtt-subscribe-topic.c @@ -59,7 +59,7 @@ static int DetectMQTTSubscribeTopicSetup(DetectEngineCtx *, Signature *, const c static int g_mqtt_subscribe_topic_buffer_id = 0; struct MQTTSubscribeTopicGetDataArgs { - int local_id; + uint32_t local_id; void *txv; }; @@ -78,8 +78,7 @@ static InspectionBuffer *MQTTSubscribeTopicGetData(DetectEngineThreadCtx *det_ct const uint8_t *data; uint32_t data_len; - if (rs_mqtt_tx_get_subscribe_topic(cbdata->txv, (uint16_t)cbdata->local_id, - &data, &data_len) == 0) { + if (rs_mqtt_tx_get_subscribe_topic(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) { return NULL; } @@ -94,7 +93,7 @@ static int DetectEngineInspectMQTTSubscribeTopic( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -151,7 +150,7 @@ static void PrefilterTxMQTTSubscribeTopic(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { struct MQTTSubscribeTopicGetDataArgs cbdata = { local_id, txv }; InspectionBuffer *buffer = MQTTSubscribeTopicGetData(det_ctx, ctx->transforms, diff --git a/src/detect-mqtt-unsubscribe-topic.c b/src/detect-mqtt-unsubscribe-topic.c index d8ae6a7b51..5409e5c6ba 100644 --- a/src/detect-mqtt-unsubscribe-topic.c +++ b/src/detect-mqtt-unsubscribe-topic.c @@ -59,7 +59,7 @@ static int DetectMQTTUnsubscribeTopicSetup(DetectEngineCtx *, Signature *, const static int g_mqtt_unsubscribe_topic_buffer_id = 0; struct MQTTUnsubscribeTopicGetDataArgs { - int local_id; + uint32_t local_id; void *txv; }; @@ -78,8 +78,7 @@ static InspectionBuffer *MQTTUnsubscribeTopicGetData(DetectEngineThreadCtx *det_ const uint8_t *data; uint32_t data_len; - if (rs_mqtt_tx_get_unsubscribe_topic(cbdata->txv, (uint16_t)cbdata->local_id, - &data, &data_len) == 0) { + if (rs_mqtt_tx_get_unsubscribe_topic(cbdata->txv, cbdata->local_id, &data, &data_len) == 0) { return NULL; } @@ -94,7 +93,7 @@ static int DetectEngineInspectMQTTUnsubscribeTopic( const Signature *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id) { - int local_id = 0; + uint32_t local_id = 0; const DetectEngineTransforms *transforms = NULL; if (!engine->mpm) { @@ -151,7 +150,7 @@ static void PrefilterTxMQTTUnsubscribeTopic(DetectEngineThreadCtx *det_ctx, const MpmCtx *mpm_ctx = ctx->mpm_ctx; const int list_id = ctx->list_id; - int local_id = 0; + uint32_t local_id = 0; while(1) { struct MQTTUnsubscribeTopicGetDataArgs cbdata = { local_id, txv }; InspectionBuffer *buffer = MQTTUnsubscribeTopicGetData(det_ctx, ctx->transforms, diff --git a/src/detect-tls-certs.c b/src/detect-tls-certs.c index 08f0a706c6..8e8fd8c0f7 100644 --- a/src/detect-tls-certs.c +++ b/src/detect-tls-certs.c @@ -71,7 +71,7 @@ static int PrefilterMpmTlsCertsRegister(DetectEngineCtx *de_ctx, static int g_tls_certs_buffer_id = 0; struct TlsCertsGetDataArgs { - int local_id; /**< used as index into thread inspect array */ + uint32_t local_id; /**< used as index into thread inspect array */ SSLCertsChain *cert; };