Aleksandar,

On 7/24/2017 5:07 PM, Aleksandar Lazic wrote:
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.

This is just the maximum size that's gonna be copied into the buffer and we know svc_port is much shorter than this.

Regards,
Nenad

Reply via email to