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
| ||
|
Date: Wed, 30 Mar 2022 02:57:15 +0000 From: David Laight <David.Laight@...LAB.COM> To: 'Michael Walle' <michael@...le.cc>, Xu Yilun <yilun.xu@...el.com>, Tom Rix <trix@...hat.com>, Jean Delvare <jdelvare@...e.com>, Guenter Roeck <linux@...ck-us.net>, Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, Russell King <linux@...linux.org.uk>, "David S . Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com> CC: "linux-hwmon@...r.kernel.org" <linux-hwmon@...r.kernel.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "netdev@...r.kernel.org" <netdev@...r.kernel.org> Subject: RE: [PATCH v2 1/5] hwmon: introduce hwmon_sanitize_name() From: Michael Walle > Sent: 29 March 2022 17:07 > > More and more drivers will check for bad characters in the hwmon name > and all are using the same code snippet. Consolidate that code by adding > a new hwmon_sanitize_name() function. I'm assuming these 'bad' hwmon names come from userspace? Like ethernet interface names?? Is silently changing the name of the hwmon entries the right thing to do at all? What happens if the user tries to create both "foo_bar" and "foo-bar"? I'm sure that is going to go horribly wrong somewhere. It would certainly make sense to have a function to verify the name is actually valid. Then bad names can be rejected earlier on. I'm also intrigued about the list of invalid characters: +static bool hwmon_is_bad_char(const char ch) +{ + switch (ch) { + case '-': + case '*': + case ' ': + case '\t': + case '\n': + return true; + default: + return false; + } +} If '\t' and '\n' are invalid why are all the other control characters allowed? I'm guessing '*' is disallowed because it is the shell wildcard? So what about '?'. Then I'd expect '/' to be invalid - but that isn't checked. Never mind all the values 0x80 to 0xff - they are probably worse than whitespace. OTOH why are any characters invalid at all - except '/'? David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Powered by blists - more mailing lists