lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bme75o5r.fsf@toke.dk>
Date:   Wed, 25 Apr 2018 16:57:52 +0200
From:   Toke Høiland-Jørgensen <toke@...e.dk>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     netdev@...r.kernel.org,
        Kevin Darbyshire-Bryant <ldir@...byshire-bryant.me.uk>
Subject: Re: [PATCH iproute2 v2] json_print: Fix hidden 64-bit type promotion

Stephen Hemminger <stephen@...workplumber.org> writes:

> On Wed, 25 Apr 2018 16:30:22 +0200
> Toke Høiland-Jørgensen <toke@...e.dk> wrote:
>
>> print_uint() will silently promote its variable type to uint64_t, but there
>> is nothing that ensures that the format string specifier passed along with
>> it fits (and the function name suggest to pass "%u").
>> 
>> Fix this by changing print_uint() to use a native 'unsigned int' type, and
>> introduce a separate print_u64() function for printing 64-bit values. All
>> call sites that were actually printing 64-bit values using print_uint() are
>> converted to use print_u64() instead.
>> 
>> Since print_int() was already using native int types, just add a
>> print_s64() to match, but don't convert any call sites.
>> 
>> Cc: Kevin Darbyshire-Bryant <ldir@...byshire-bryant.me.uk>
>> Signed-off-by: Toke Høiland-Jørgensen <toke@...e.dk>
>
> Yes, this makes sense. Maybe there should be a print_luint for
> consistency.

I just realised I missed a few call sites, so I'll resend. Should I
call the new function print_luint() instead of print_u64()?

> Also, I tried (in vain) to make a version that allows GCC to check the
> format string.  But it was a struggle and just gave up.

Yeah, no idea how to do this either...

-Toke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ