mirror of
https://github.com/yrutschle/sslh.git
synced 2025-06-10 04:12:18 +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)
|
for (addr = addr_list; addr; addr = addr->ai_next)
|
||||||
num_addr++;
|
num_addr++;
|
||||||
|
|
||||||
|
if (num_addr == 0) {
|
||||||
|
fprintf(stderr, "FATAL: No available addresses.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "listening to %d addresses\n", num_addr);
|
fprintf(stderr, "listening to %d addresses\n", num_addr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user