Re: [PATCH 2/2] BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in Server.get_addr()

2017-07-24 Thread Aleksandar Lazic
Hi Nenad.

Nenad wrote on 24.07.2017:

> 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 
>>> *)>addr)->sin6_addr,
>>> - addr, INET_ADDRSTRLEN);
>>> + addr, INET6_ADDRSTRLEN);
>>> luaL_addstring(, addr);
>>> luaL_addstring(, ":");
>>> 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.

Ah okay thanks.

> Regards,
> Nenad

-- 
Best Regards
Aleks




Re: [PATCH 2/2] BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in Server.get_addr()

2017-07-24 Thread Nenad Merdanovic

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 
*)>addr)->sin6_addr,
- addr, INET_ADDRSTRLEN);
+ addr, INET6_ADDRSTRLEN);
luaL_addstring(, addr);
luaL_addstring(, ":");
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



Re: [PATCH 2/2] BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in Server.get_addr()

2017-07-24 Thread Aleksandar Lazic
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 
> *)>addr)->sin6_addr,
> - addr, INET_ADDRSTRLEN);
> + addr, INET6_ADDRSTRLEN);
> luaL_addstring(, addr);
> luaL_addstring(, ":");
> 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




[PATCH 2/2] BUG/MINOR: lua: Correctly use INET6_ADDRSTRLEN in Server.get_addr()

2017-07-23 Thread Nenad Merdanovic
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 
*)>addr)->sin6_addr,
- addr, INET_ADDRSTRLEN);
+ addr, INET6_ADDRSTRLEN);
luaL_addstring(, addr);
luaL_addstring(, ":");
snprintf(addr, INET_ADDRSTRLEN, "%d", srv->svc_port);
-- 
2.11.0