From: Georgios Kontaxis Date: Mon, 24 Aug 2026 03:39:33 +0000 (+0000) Subject: nits X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=8cb0e2d599fd9ea3f590a8aaa50522a2a1c3f14b;p=snidump.git nits --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/dependencies.txt b/dependencies.txt new file mode 100644 index 0000000..9624ab3 --- /dev/null +++ b/dependencies.txt @@ -0,0 +1,2 @@ +libpcap-dev +libpcre3-dev diff --git a/src/colors.h b/src/colors.h index cc3881c..0691f0e 100644 --- a/src/colors.h +++ b/src/colors.h @@ -5,10 +5,10 @@ #include #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); \ diff --git a/src/snidump.c b/src/snidump.c index 45608cf..0f2aef3 100644 --- a/src/snidump.c +++ b/src/snidump.c @@ -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. */ diff --git a/src/tls.c b/src/tls.c index b1bfc5e..9416601 100644 --- 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 */