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: <9b88baed-a067-fcfd-d087-66e36f3060d7@mellanox.com>
Date:	Sat, 9 Jul 2016 23:13:33 -0400
From:	Chris Metcalf <cmetcalf@...lanox.com>
To:	Markus Mayer <mmayer@...adcom.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Al Viro <viro@...iv.linux.org.uk>,
	"Rasmus Villemoes" <linux@...musvillemoes.dk>,
	Kees Cook <keescook@...omium.org>
CC:	<dri-devel@...ts.freedesktop.org>, <nouveau@...ts.freedesktop.org>,
	<linux-acpi@...r.kernel.org>, <speakup@...ux-speakup.org>,
	<devel@...verdev.osuosl.org>, <linux-scsi@...r.kernel.org>,
	<target-devel@...r.kernel.org>, <linux-pm@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 0/7] lib: string: add functions to case-convert strings

On 7/8/2016 6:43 PM, Markus Mayer wrote:
> This series introduces a family of generic string case conversion
> functions. This kind of functionality is needed in several places in
> the kernel. Right now, everybody seems to be implementing their own
> copy of this functionality.
>
> Based on the discussion of the previous version of this series[1] and
> the use cases found in the kernel, it does look like having several
> flavours of case conversion functions is beneficial. The use cases fall
> into three categories:
>      - copying a string and converting the case while specifying a
>        maximum length to mimic strlcpy()
>      - copying a string and converting the case without specifying a
>        length to mimic strcpy()
>      - converting the case of a string in-place (i.e. modifying the
>        string that was passed in)
>
> Consequently, I am proposing these new functions:
>      void strlcpytoupper(char *dst, const char *src, size_t len);
>      void strlcpytolower(char *dst, const char *src, size_t len);
>      void strcpytoupper(char *dst, const char *src);
>      void strcpytolower(char *dst, const char *src);
>      void strtoupper(char *s);
>      void strtolower(char *s);

You may want to read the article here:

https://lwn.net/Articles/659214/

and follow up some of the discussion threads on LKML about the best
semantics to advertise for the strlcpy/strscpy variants.  It might be
helpful to return some kind of overflow/truncation error from your
copy functions so people can error-check the result.

-- 
Chris Metcalf, Mellanox Technologies
http://www.mellanox.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ