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);
```
This commit is contained in:
Ivan Nardi
2023-09-10 11:09:59 +02:00
committed by GitHub
parent 805df2e5ce
commit 2b883b93be
13 changed files with 1333 additions and 21 deletions
+5 -1
View File
@@ -126,13 +126,16 @@
<ClCompile Include="..\src\lib\ndpi_bitmap.c" />
<ClCompile Include="..\src\lib\ndpi_classify.c" />
<ClCompile Include="..\src\lib\ndpi_community_id.c" />
<ClCompile Include="..\src\lib\ndpi_domain_classify.c" />
<ClCompile Include="..\src\lib\ndpi_geoip.c" />
<ClCompile Include="..\src\lib\ndpi_main.c" />
<ClCompile Include="..\src\lib\ndpi_filter.c" />
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
<ClCompile Include="..\src\lib\ndpi_binary_bitmap.c" />
<ClCompile Include="..\src\lib\ndpi_hash.c" />
<ClCompile Include="..\src\lib\ndpi_domain_classify.c" />
<ClCompile Include="..\src\lib\ndpi_bitmap64.c" />
<ClCompile Include="..\src\lib\protocols\activision.c" />
<ClCompile Include="..\src\lib\protocols\afp.c" />
<ClCompile Include="..\src\lib\protocols\ajp.c" />
@@ -377,6 +380,7 @@
</ClInclude>
<ClInclude Include="src\ndpi_config.h" />
<ClInclude Include="src\ndpi_define.h" />
<ClInclude Include="src\dirent.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\.github\workflows\build-msbuild.yml" />
+5
View File
@@ -124,6 +124,10 @@
<ClCompile Include="..\src\lib\ndpi_memory.c" />
<ClCompile Include="..\src\lib\ndpi_serializer.c" />
<ClCompile Include="..\src\lib\ndpi_utils.c" />
<ClCompile Include="..\src\lib\ndpi_binary_bitmap.c" />
<ClCompile Include="..\src\lib\ndpi_hash.c" />
<ClCompile Include="..\src\lib\ndpi_domain_classify.c" />
<ClCompile Include="..\src\lib\ndpi_bitmap64.c" />
<ClCompile Include="..\src\lib\protocols\ajp.c" />
<ClCompile Include="..\src\lib\protocols\amazon_video.c" />
<ClCompile Include="..\src\lib\protocols\among_us.c" />
@@ -245,6 +249,7 @@
<ClInclude Include="..\src\include\ndpi_win32.h" />
<ClInclude Include="arpa\inet.h" />
<ClInclude Include="src\getopt.h" />
<ClInclude Include="src\dirent.h" />
<ClInclude Include="..\src\include\ndpi_encryption.h" />
<ClInclude Include="..\src\include\ndpi_main.h" />
<ClInclude Include="..\src\include\ndpi_utils.h" />
+1239
View File
File diff suppressed because it is too large Load Diff