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]
Date:   Thu, 13 Jul 2023 08:18:45 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Kees Cook' <keescook@...omium.org>
CC:     'Azeem Shaikh' <azeemshaikh38@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] kobject: Replace strlcpy with strscpy

From: Kees Cook <keescook@...omium.org>
> Sent: 13 July 2023 00:53
....
> > > pr_warn("init_uevent_argv: buffer size of %d too small for %s, needed
> > > %d\n", buffer_size, subsystem, strlen(subsystem));
> > >
> > > Does that seem better?
> 
> Yeah, that'll retain the intention of the warning. It shouldn't really
> even be possible to hit that warning, so I don't think we need to worry
> about the "extra" call to strlen().
> 
> > Not with the justification for not using strlcpy() :-)
> 
> What?

The commit message says that strlcpy() isn't used because
of possible 'read beyond buffer end' (etc) if it isn't
'\0' terminated.

But here if (extremely unlikely) the source isn't terminated
then the extra reads get done anyway.
So the commit message just doesn't match the change.

I'd guess that it is possible for there to be insufficient space.
Probably because other strings have filled the buffer.
The error message might be better as:
	"insufficient buffer space (%u left) for %s\n",
		buffer_size, subsystem);

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ