From 7fb64162e167ae6822bd2f7e88daa59829eebcce Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Thu, 11 Jan 2024 14:30:25 +0100 Subject: [PATCH] tests: fix segfault with no /etc/protocols (#286) This file could be missing, which will cause getprotobynumber() to return NULL. The returned pointer is used to mention the protocol name in a warning message, not critical. Instead, we can simply display 'Unknown' next to the protocol ID. Fixes: d6a48d4 ("tests: Expand mptcpwrap code coverage. (#169)") Reported-by: Aurelien Jarno Closes: https://bugs.debian.org/1060285 Signed-off-by: Matthieu Baerts (NGI0) --- tests/mptcpwrap-tester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mptcpwrap-tester.c b/tests/mptcpwrap-tester.c index 3d004007..1e7170b7 100644 --- a/tests/mptcpwrap-tester.c +++ b/tests/mptcpwrap-tester.c @@ -64,7 +64,7 @@ static void test_socket_data(struct socket_data const *data) "WARNING: Ignoring unsupported " "protocol: %d - %s\n", data->protocol, - p->p_name); + p ? p->p_name : "Unknown"); return; }