mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-14 08:07:14 +03:00
start_listen_sockets: exit if no addresses
Do not allocate a 0 byte buffer if no addresses are available: common.c:122:14: warning: Call to 'malloc' has an allocation size of 0 bytes *sockfd = malloc(num_addr * sizeof(*sockfd[0])); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
parent
552723cc5f
commit
c179d9a57b
5
common.c
5
common.c
@ -116,6 +116,11 @@ int start_listen_sockets(int *sockfd[], struct addrinfo *addr_list)
|
||||
for (addr = addr_list; addr; addr = addr->ai_next)
|
||||
num_addr++;
|
||||
|
||||
if (num_addr == 0) {
|
||||
fprintf(stderr, "FATAL: No available addresses.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "listening to %d addresses\n", num_addr);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user