> On 3 May 2018, at 18:49, Willy Tarreau <[email protected]> wrote:
> 
> On Thu, May 03, 2018 at 03:35:41PM +0200, Thierry Fournier wrote:
>> Ok, I understand ... I hesitate. I think that is better to keep
>> the original type, but the consistency is a good reason to convert
>> to string.
>> 
>> I doubt that integer operations (add, sub, ...) will be performed on
>> this id. So maybe, we can keep string for the consistency.
>> 
>> If anyone have an opinion, do not hesitate...
> 
> OK then I picked it. However I noticed something wrong that I fixed
> and which is wrong in other parts of the code :
> 
>  char buffer[10];
>  (...)
>  snprintf(buffer, sizeof(buffer), "%d", srv->puid);
>  lua_pushstring(L, buffer);
> 
> With UIDs larger than 999999999 snprintf() will fail and we'll push a
> random string in the buffer. So I fixed it to set the buffer size to
> 12 ("-2147483648"). I'll have to fix the other places in the same code
> part for this as well.
> 
> It's extremely unlikely anyone will notice it since few people use manual
> IDs, but if some automated tool builds these IDs using ranges, this will
> definitely fail.


Thanks Willy.
Thierry

Reply via email to