Messages in this thread | | | From | David Laight <> | Subject | RE: [PATCH v4] EDAC/mc: Prefer strscpy over strcpy | Date | Wed, 25 Aug 2021 08:48:03 +0000 |
| |
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)
| |