aboutsummaryrefslogtreecommitdiff
path: root/src/include/ndpi_typedefs.h
diff options
context:
space:
mode:
authorIvan Nardi <12729895+IvanNardi@users.noreply.github.com>2023-09-10 11:09:59 +0200
committerGitHub <noreply@github.com>2023-09-10 11:09:59 +0200
commit2b883b93be5feef26469fb07ca126b7c13b2fd21 (patch)
tree0f9bbcde2e9d41a86bdce1edfdab1588729c52ae /src/include/ndpi_typedefs.h
parent805df2e5ceebf9252248ac4514d47ba8756c4042 (diff)
Fix some errors found by fuzzers (#2078)
Fix compilation on Windows. "dirent.h" file has been taken from https://github.com/tronkko/dirent/ Fix Python bindings Fix some warnings with x86_64-w64-mingw32-gcc: ``` protocols/dns.c: In function ‘ndpi_search_dns’: protocols/dns.c:775:41: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 775 | unsigned long first_element_len = (unsigned long)dot - (unsigned long)_hostname; | ^ protocols/dns.c:775:62: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] 775 | unsigned long first_element_len = (unsigned long)dot - (unsigned long)_hostname; | ``` ``` In file included from ndpi_bitmap64.c:31: third_party/include/binaryfusefilter.h: In function ‘binary_fuse8_hash’: third_party/include/binaryfusefilter.h:160:32: error: left shift count >= width of type [-Werror=shift-count-overflow] 160 | uint64_t hh = hash & ((1UL << 36) - 1); ``` ``` In function ‘ndpi_match_custom_category’, inlined from ‘ndpi_fill_protocol_category.part.0’ at ndpi_main.c:7056:16: ndpi_main.c:3419:3: error: ‘strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=] 3419 | strncpy(buf, name, name_len); ```
Diffstat (limited to 'src/include/ndpi_typedefs.h')
-rw-r--r--src/include/ndpi_typedefs.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h
index 47e2b9897..d440a9e74 100644
--- a/src/include/ndpi_typedefs.h
+++ b/src/include/ndpi_typedefs.h
@@ -625,6 +625,19 @@ struct ndpi_flow_input_info {
unsigned char seen_flow_beginning;
};
+/* Save memory limiting the key to 56 bit */
+//#define SAVE_BINARY_BITMAP_MEMORY
+
+PACK_ON
+struct ndpi_binary_bitmap_entry {
+#ifdef SAVE_BINARY_BITMAP_MEMORY
+ u_int64_t value:56, category:8;
+#else
+ u_int64_t value;
+ u_int8_t category;
+#endif
+} PACK_OFF;
+
/* ******************* ********************* ****************** */
/* ************************************************************ */
@@ -1180,19 +1193,6 @@ typedef void ndpi_bitmap;
typedef void ndpi_bitmap64;
typedef void ndpi_bitmap_iterator;
typedef void ndpi_filter;
-
-/* Save memory limiting the key to 56 bit */
-//#define SAVE_BINARY_BITMAP_MEMORY
-
-PACK_ON
-struct ndpi_binary_bitmap_entry {
-#ifdef SAVE_BINARY_BITMAP_MEMORY
- u_int64_t value:56, category:8;
-#else
- u_int64_t value;
- u_int8_t category;
-#endif
-} PACK_OFF;
typedef struct {
u_int32_t num_allocated_entries, num_used_entries;