From 8b604a3db7dc0ed1d14939f6497776e8268e59ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yves=20R=C5=B1tschl=C3=A9?= Date: Sun, 24 Jul 2022 17:50:13 +0200 Subject: [PATCH] defensive programming against inconsistent configuration (fix #336 more) --- probe.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/probe.c b/probe.c index 84d14bd..aa9db03 100644 --- a/probe.c +++ b/probe.c @@ -395,6 +395,13 @@ int probe_buffer(char* buf, int len, return PROBE_AGAIN; /* Everything failed: match the last one */ + + if (proto_len == 0) { + /* This should be caught by configuration sanity checks, but just in + * case, die gracefully rather than segfaulting */ + print_message(msg_int_error, "Received traffic on transport that has no target\n"); + exit(0); + } *proto_out = proto_in[proto_len-1]; return PROBE_MATCH; }