On 18/07/14 13:18, Andres Freund wrote:
> On 2014-07-18 13:08:24 +0200, Petr Jelinek wrote:
>> On 18/07/14 00:41, Andres Freund wrote:
>>> Wouldn't it be better to use sscanf()? That should work with large
>>> inputs across platforms.
>>>
>>
>> Well, sscanf does not do much validation and silently truncates too big
>> input (which is why I replaced it with strtoull, original patch did have
>> sscanf)
>
> Well, the checks on length you've added should catch that when adapted
> properly.
I don't see a portable way how to validate too big input values when
using sscanf.
>
> Maybe it's time to pursue
> http://archives.postgresql.org/message-id/20140603144654.GM24145%40awork2.anarazel.de
> further :(
>
Yes, I've seen that patch and was quite sad that it didn't make it in core.
-- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training &
Services