Hi Nenad Merdanovic,

Nenad Merdanovic wrote on 24.07.2017:

> The get_addr() method of the Lua Server class incorrectly used
> INET_ADDRSTRLEN for IPv6 addresses resulting in failing to convert
> longer IPv6 addresses to strings.

> This fix should be backported to 1.7.
> ---
>  src/hlua_fcn.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/src/hlua_fcn.c b/src/hlua_fcn.c
> index 0df9025c..420c7664 100644
> --- a/src/hlua_fcn.c
> +++ b/src/hlua_fcn.c
> @@ -550,7 +550,7 @@ int hlua_server_get_addr(lua_State *L)
>                 break;
>         case AF_INET6:
>                 inet_ntop(AF_INET6, &((struct sockaddr_in6 
> *)&srv->addr)->sin6_addr,
> -                         addr, INET_ADDRSTRLEN);
> +                         addr, INET6_ADDRSTRLEN);
>                 luaL_addstring(&b, addr);
>                 luaL_addstring(&b, ":");
>                 snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);^
                        ^^^^^^^^
Shouldn't there also be a INET6_ADDRSTRLEN?
I think the port should be added into the len.

But I'm not that fit in networking and lua, just a wild gues.

Regards
Aleks
-- 
Best Regards
Aleks


Reply via email to