detect: fix some -Wshorten-64-to-32 warnings

Ticket: #6186
pull/13251/head
Philippe Antoine 3 months ago committed by Victor Julien
parent 256804b7b1
commit 4085cf44db

@ -3487,9 +3487,10 @@ static uint32_t DetectKeywordCtxHashFunc(HashListTable *ht, void *data, uint16_t
{
DetectEngineThreadKeywordCtxItem *ctx = data;
const char *name = ctx->name;
uint64_t hash = StringHashDjb2((const uint8_t *)name, strlen(name)) + (ptrdiff_t)ctx->data;
uint64_t hash =
StringHashDjb2((const uint8_t *)name, (uint32_t)strlen(name)) + (ptrdiff_t)ctx->data;
hash %= ht->array_size;
return hash;
return (uint32_t)hash;
}
static char DetectKeywordCtxCompareFunc(void *data1, uint16_t len1, void *data2, uint16_t len2)

@ -75,7 +75,7 @@ static bool DetectFTPReplyGetData(DetectEngineThreadCtx *_det_ctx, const void *t
DEBUG_VALIDATE_BUG_ON(wrapper->response == NULL);
if (index == count) {
*buffer = (const uint8_t *)wrapper->response->response;
*buffer_len = wrapper->response->length;
*buffer_len = (uint32_t)wrapper->response->length;
return true;
}
count++;

@ -462,7 +462,7 @@ static int g_response_header_thread_id = 0;
typedef struct HttpMultiBufItem {
uint8_t *buffer;
size_t len;
uint32_t len;
} HttpMultiBufItem;
typedef struct HttpMultiBufHeaderThreadData {
@ -539,9 +539,9 @@ static bool GetHttp1HeaderData(DetectEngineThreadCtx *det_ctx, const void *txv,
}
for (size_t i = 0; i < no_of_headers; i++) {
const htp_header_t *h = htp_headers_get_index(headers, i);
size_t size1 = htp_header_name_len(h);
size_t size2 = htp_header_value_len(h);
size_t size = size1 + size2 + 2;
uint32_t size1 = (uint32_t)htp_header_name_len(h);
uint32_t size2 = (uint32_t)htp_header_value_len(h);
uint32_t size = size1 + size2 + 2;
if (hdr_td->items[i].len < size) {
// Use realloc, as this pointer is not freed until HttpMultiBufHeaderThreadDataFree
void *tmp = SCRealloc(hdr_td->items[i].buffer, size);

Loading…
Cancel
Save