Thread (10 messages) 10 messages, 4 authors, 2021-08-29

RE: [PATCH v4] EDAC/mc: Prefer strscpy over strcpy

From: David Laight <hidden>
Date: 2021-08-25 08:48:35
Also in: linux-hardening, lkml

From: Borislav Petkov
Sent: 24 August 2021 19:26
..
so looking at the code, we're merrily decrementing len but nothing's
checking whether len can become 0. Because if it does, strscpy() will
do:

	if (count == 0 || WARN_ON_ONCE(count > INT_MAX))
		return -E2BIG;
That -E2BIG is going to break something.
It means that you always have to do an error check whenever
you use the return value of strscpy().

Anything that does:
	offset += strscpy(...)
is broken.

It really wasn't a good idea for reporting 'truncated'.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help