From aa79e6e4eff65e722ef66ab61cb6aa20805a7dec Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 29 Nov 2023 08:59:52 +0100 Subject: [PATCH] Fixed issue #2217: Replace inet_ntoa with inet_ntop to support IPv6 with xdebug://gateway --- src/debugger/ip_info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/debugger/ip_info.c b/src/debugger/ip_info.c index 143fd722c..abe858c4a 100644 --- a/src/debugger/ip_info.c +++ b/src/debugger/ip_info.c @@ -222,11 +222,12 @@ char *xdebug_get_gateway_ip(void) { in_addr_t addr = 0; char iface[IF_NAMESIZE]; + char addrbuf[INET6_ADDRSTRLEN]; memset(iface, 0, sizeof(iface)); if (get_gateway_and_iface(&addr, iface)) { - return xdstrdup(inet_ntoa(*(struct in_addr *) &addr)); + return xdstrdup(inet_ntop(AF_INET, &addr, addrbuf, sizeof(addrbuf))); } return NULL;