FoxIO-LLC / ja4

JA4+ is a suite of network fingerprinting standards
https://foxio.io
Other
774 stars 65 forks source link

Wireshark: strict compilation fails after recent change #133

Open Boolean263 opened 3 days ago

Boolean263 commented 3 days ago

The change made in #132 causes a build failure for me. Using an in-tree build based on Wireshark's release-4.2 branch (the development trunk for 4.2.x builds), compiling with clang-15 on Ubuntu 22.04 jammy.

Apparently the change I made to timediff() in #128 isn't as universal as I'd hoped, or else you wouldn't have needed to make #132. Cross-platform portable source code is still a hard problem to solve, evidently. The full error message is:

 /.../wireshark/plugins/epan/ja4/packet-ja4.c:672:51: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                    wmem_strbuf_append_printf(display, "%" PRId64, (long long) diff);
                                                        ~~~~~~~~~  ^~~~~~~~~~~~~~~~
/.../wireshark/plugins/epan/ja4/packet-ja4.c:679:53: error: format specifies type 'long' but the argument has type 'long long' [-Werror,-Wformat]
                    wmem_strbuf_append_printf(display, "-R%" PRId64, (long long) diff);
                                                          ~~~~~~~~~  ^~~~~~~~~~~~~~~~
2 errors generated.

One possible solution would be to change timediff() to return an int64_t. PRId64 is meant to hold the specific printf format string needed to print a int64_t, and both come from <inttypes.h> (which is included via <wireshark.h>).

It might make more logical sense for timediff() to return a time_t, but it's another one of those types that has different underlying representations on different systems. If there's a portable printf format string for time_t I'm not aware of it.