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] [day] [month] [year] [list]
Message-ID: <20180110230131.GD6499@thunk.org>
Date:   Wed, 10 Jan 2018 18:01:31 -0500
From:   Theodore Ts'o <tytso@....edu>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Xiongfeng Wang <wangxiongfeng2@...wei.com>,
        Jan Kara <jack@...e.cz>,
        Andreas Dilger <adilger.kernel@...ger.ca>,
        linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: use strlcpy() instead of strncpy()

On Wed, Jan 10, 2018 at 10:30:15PM +0100, Arnd Bergmann wrote:
> This warning option appears to be particularly good in finding code that
> is actually dangerous in case of an overflow, and generally using
> strscpy() improves either correctness and readability over strncpy(),
> I think it's worth leaving enabled globally.
> 
> I have an experimental patch series to let you wrap the _Pragma("GCC
> diagnostic ingnored \"-Wstringop-truncation\"") directive in some
> nicer syntax. Would that work for you here?

Having a Pragma which silences errors is certainly better than
nothing, but what might be nice is to have a way of tagging a variable
or structure member function as "not guaranteed to be null
terminated".  That would suppress warnings where strncpy is used to
set the character array, and add warnings if how the character array
is accessed without taking due care that it might not be
null-terminated.

Essentially all of the on-disk strings in ext4 are not NUL terminated
(or not necessarily NUL terminated).  We either use an explicit length
(directory entries) or we use a fixed length character array (for the
things like the volume label, last error function, etc.)

Cheers,

					- Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ