]> git.99rst.org Git - snidump.git/commitdiff
nits dev/2026-fixes
authorGeorgios Kontaxis <redacted>
Mon, 24 Aug 2026 03:39:33 +0000 (03:39 +0000)
committerGeorgios Kontaxis <redacted>
Mon, 24 Aug 2026 03:51:19 +0000 (03:51 +0000)
.gitignore [new file with mode: 0644]
dependencies.txt [new file with mode: 0644]
src/colors.h
src/snidump.c
src/tls.c

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..ae3c172
--- /dev/null
@@ -0,0 +1 @@
+/bin/
diff --git a/dependencies.txt b/dependencies.txt
new file mode 100644 (file)
index 0000000..9624ab3
--- /dev/null
@@ -0,0 +1,2 @@
+libpcap-dev
+libpcre3-dev
index cc3881c84538fa89e599fd67933a73c1278be95f..0691f0e96a69bdab313b22968ee6e2bdadf773fc 100644 (file)
@@ -5,10 +5,10 @@
 #include <unistd.h>
 
 #define IFTTY_STDOUT(x) (istty_stdout ? (x) : "")
-uint8_t istty_stdout;
+extern uint8_t istty_stdout;
 
 #define IFTTY_STDERR(x) (istty_stderr ? (x) : "")
-uint8_t istty_stderr;
+extern uint8_t istty_stderr;
 
 #define C_RED_LIGHT    "1;31"
 #define C_GREEN_LIGHT  "1;32"
@@ -17,6 +17,7 @@ uint8_t istty_stderr;
 #define C_CYAN_LIGHT   "1;36"
 
 /* Must be called at least once to determine where stdout, stderr refer to. */
+#define CPRINT_SETUP uint8_t istty_stdout, istty_stderr;
 #define CPRINT_INIT {\
        istty_stdout = isatty(STDOUT_FILENO); \
        istty_stderr = isatty(STDERR_FILENO); \
index 45608cff3f8c7d4100f7fbb2d009f6c8c51e0adb..0f2aef3390972c5d3d9a50901e66d0b58d9372ff 100644 (file)
@@ -71,8 +71,13 @@ struct my_iphdr
 
 #define IPVERSION 4
 
+#ifndef IPPROTO_TCP
 #define IPPROTO_TCP  6
+#endif
+
+#ifndef IPPROTO_UDP
 #define IPPROTO_UDP 17
+#endif
 
 /* TCP */
 
@@ -357,6 +362,8 @@ void signal_handler (int signum)
 #define BPF bpf_s
 #define BPF_OPTIMIZE 1
 
+CPRINT_SETUP
+
 int main (int argc, char *argv[])
 {
        /* Name of the network interface to capture from. */
index b1bfc5ef4b8303dc348d445f59f8cd9444c12b38..94166015d206ecc9ccc9dcb6a026a5933a08078d 100644 (file)
--- a/src/tls.c
+++ b/src/tls.c
@@ -608,7 +608,14 @@ uint32_t tls_process_record(uint8_t *payload, uint32_t payload_length)
        /* Read context. */
        ctx.in = payload;
        ctx.read_bytes_available = payload_length;
+#pragma GCC diagnostic push
+       /* Here we read the address of a local variable into a pointer.
+        * The pointer becomes dangling if used outside the frame of
+        * the current function. This doesn't happen. The pointer is
+        * used by nested function calls so we suppress the warning. */
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
        tls_in = &ctx;
+#pragma GCC diagnostic pop
 
        while (ctx.read_bytes_available > 0) {
                /* read SSL/TLS record header */
git clone https://git.99rst.org/PROJECT