From 7bd256171bba4804a4d96fa67f6e39b1d86828b9 Mon Sep 17 00:00:00 2001 From: CPunch Date: Fri, 15 Apr 2022 00:25:36 -0500 Subject: [PATCH] Fix: inet_ntop passed the wrong pointer --- lib/src/lsocket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/lsocket.c b/lib/src/lsocket.c index c38eaa6..937c23f 100644 --- a/lib/src/lsocket.c +++ b/lib/src/lsocket.c @@ -160,8 +160,8 @@ void laikaS_acceptFrom(struct sLaika_socket *sock, struct sLaika_socket *from, c LAIKA_ERROR("accept() failed!\n"); /* read ipv4 */ - if (ipv4 != NULL) { - if (inet_ntop(AF_INET, &address, ipv4, LAIKA_IPV4_LEN) == NULL) + if (ipv4) { + if (inet_ntop(AF_INET, &address.sin_addr, ipv4, LAIKA_IPV4_LEN) == NULL) LAIKA_ERROR("inet_ntop() failed!\n"); /* restore null terminator */