From bc31d631989d3c680cbd7fe91da19a8d27220608 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 5 Dec 2020 16:26:30 +0100 Subject: [PATCH] avoid sprintf NULL pointer --- host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/host.c b/host.c index d152c80..4424a23 100644 --- a/host.c +++ b/host.c @@ -95,7 +95,7 @@ host_t *get_host(char *ip, int port, struct sockaddr_in *v4, struct sockaddr_in6 if(tmp->sin6_scope_id != 0) { host->ip = malloc(INET6_ADDRSTRLEN + 9); /* plus [ % ] \0 , scope*/ - sprintf(host->ip, "[%s%%%d]", ip, tmp->sin6_scope_id); + sprintf(host->ip, "[%s%%%d]", myip, tmp->sin6_scope_id); } else { host->ip = malloc(INET6_ADDRSTRLEN + 3); /* plus [ ] \0 */