Skip to content

Commit

Permalink
tests: fix segfault with no /etc/protocols (#286)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Closes: https://bugs.debian.org/1060285

Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe authored Jan 11, 2024
1 parent 863e83f commit 7fb6416
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/mptcpwrap-tester.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 7fb6416

Please sign in to comment.