mitmd

mitm TCP connections
Log | Files | Refs | README

commit a3383c0a431f7c49a24854dc9595e192d870e851
parent fee98f157d33b904afc04a1048b6adeac77e8ad5
Author: hhvn <dev@hhvn.uk>
Date:   Wed, 16 Jun 2021 23:56:22 +0100

mitmd.c: fix segfault after failed getaddrinfo()

Diffstat:
Mmitmd.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mitmd.c b/mitmd.c @@ -100,9 +100,9 @@ mitm(int client, char *host, char *port) { hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - if ((sret = getaddrinfo(host, port, &hints, &ai)) != 0 || ai == NULL) { + if ((sret = getaddrinfo(host, port, &hints, &ai)) != 0) { dprintf(client, "getaddrinfo(): %s\n", gai_strerror(sret)); - goto cleanup; + return; } if ((remote = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == 1) { dprintf(client, "socket(): %s\n", strerror(errno));